]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Make sure odisks is consistent between creating and using the fdlist
authorNeilBrown <neilb@suse.de>
Mon, 31 Jan 2011 06:09:20 +0000 (17:09 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 31 Jan 2011 06:09:20 +0000 (17:09 +1100)
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>
Grow.c

diff --git a/Grow.c b/Grow.c
index 748fbf68d134564618be3a1708d760913fdd8322..cdabce1f7c4ea04c59a9ee7df2c5677d3dd22375 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -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(