Fix default size calculations that were recently broken.

commit d04f65f48c
    Change the values for "max size" from -1 to 1.

Messed up 's->size' - leaving it as '1' (MAX_SIZE) in some cases and
causing the array reshape to fail.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2012-08-13 08:00:18 +10:00
parent f2e29ad691
commit 0a8b92a6f6
2 changed files with 6 additions and 2 deletions

View File

@ -124,7 +124,9 @@ int Build(char *mddev, struct mddev_dev *devlist,
if (vers >= 9000) {
mdu_array_info_t array;
array.level = s->level;
array.size = s->size == MAX_SIZE ? 0 : s->size;
if (s->size == MAX_SIZE)
s->size = 0;
array.size = s->size;
array.nr_disks = s->raiddisks;
array.raid_disks = s->raiddisks;
array.md_minor = 0;

4
Grow.c
View File

@ -1716,7 +1716,9 @@ int Grow_reshape(char *devname, int fd,
st->update_tail = &st->updates;
}
array.size = s->size == MAX_SIZE ? 0 : s->size;
if (s->size == MAX_SIZE)
s->size = 0;
array.size = s->size;
if ((unsigned)array.size != s->size) {
/* got truncated to 32bit, write to
* component_size instead