Make sure odisks is consistent between creating and using the fdlist

reshape_prepare_fdlist and child_monitor currently have slightly
different ideas of the 'old number of raid devices' which can cause
major confusion.

So settle on one value, and assign it to odisks early and always use
it.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2011-01-31 17:09:20 +11:00
parent 7f913e9b21
commit b8b286a639
1 changed files with 5 additions and 4 deletions

9
Grow.c
View File

@ -1838,7 +1838,9 @@ started:
/* Now we need to open all these devices so we can read/write.
*/
nrdisks = array.raid_disks + sra->array.spare_disks;
nrdisks = max(reshape.before.data_disks,
reshape.after.data_disks) + reshape.parity
+ sra->array.spare_disks;
fdlist = malloc((1+nrdisks) * sizeof(int));
offsets = malloc((1+nrdisks) * sizeof(offsets[0]));
if (!fdlist || !offsets) {
@ -1846,7 +1848,8 @@ started:
goto release;
}
d = reshape_prepare_fdlist(devname, sra, array.raid_disks,
odisks = reshape.before.data_disks + reshape.parity;
d = reshape_prepare_fdlist(devname, sra, odisks,
nrdisks, blocks, backup_file,
fdlist, offsets);
if (d < 0) {
@ -1998,8 +2001,6 @@ started:
fd = -1;
mlockall(MCL_FUTURE);
odisks = reshape.before.data_disks + reshape.parity;
if (st->ss->external) {
/* metadata handler takes it from here */
done = st->ss->manage_reshape(