]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: fix --force assemble during reshape.
authorNeilBrown <neilb@suse.de>
Tue, 7 Feb 2012 03:06:44 +0000 (14:06 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 7 Feb 2012 03:06:44 +0000 (14:06 +1100)
If we have to --force assembly during reshape, we need to
check by the 'before' and 'after' cases to make sure there
are enough devices.

Reported-by: Richard Herd <2001oddity@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c

index 972398e5513cfde4d52b4c4f7e0dd4f364bd76a5..ad4eb9c64500d1e6e736b62199d2bad6677b0299 100644 (file)
@@ -963,9 +963,17 @@ int Assemble(struct supertype *st, char *mddev,
                }
        }
        free(devmap);
-       while (force && !enough(content->array.level, content->array.raid_disks,
-                               content->array.layout, 1,
-                               avail)) {
+       while (force &&
+              (!enough(content->array.level, content->array.raid_disks,
+                       content->array.layout, 1,
+                       avail)
+               ||
+               (content->reshape_active && content->delta_disks > 0 &&
+                !enough(content->array.level, (content->array.raid_disks
+                                               - content->delta_disks),
+                        content->new_layout, 1,
+                        avail)
+                       ))) {
                /* Choose the newest best drive which is
                 * not up-to-date, update the superblock
                 * and add it.