]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Don't complain about missing spares when reshaping a raid0.
authorNeilBrown <neilb@suse.de>
Wed, 12 Jan 2011 04:59:24 +0000 (15:59 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 12 Jan 2011 04:59:24 +0000 (15:59 +1100)
To reshape a RAID0 we convert to RAID4 first.  This makes it look
like it could be degraded and so we are tempted to ensure there are
enough spares.  However this is not appropriate for RAID0, so
explicitly exclude new_level == RAID0 in this check

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 9edd4c71942d2fc3ba91aeb368f24185c7e0484f..109b0c19a56b0b94229e921e4d3ddc4f2e35f99e 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1613,7 +1613,9 @@ static int reshape_array(char *container, int fd, char *devname,
                            reshape.after.data_disks)
                + reshape.parity - array.raid_disks;
 
-       if (!force && spares_needed > info->array.spare_disks) {
+       if (!force &&
+           info->new_level > 0 &&
+           spares_needed > info->array.spare_disks) {
                fprintf(stderr,
                        Name ": Need %d spare%s to avoid degraded array,"
                        " and only have %d.\n"