]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: reject raid-disks reduction in RAID5 etc before 2.6.32
authorNeilBrown <neilb@suse.de>
Tue, 20 Oct 2009 05:36:03 +0000 (16:36 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 20 Oct 2009 05:36:03 +0000 (16:36 +1100)
2.6.31 has some bugs with restarting a RAID5 reduction, so
refuse to try unless at least 2.6.32.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 4bd77d94f8ecdd808b2aa57715161f5da5768186..1111526ba6259623f9297d38e3e222a1f7d40f40 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -523,6 +523,14 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        devname);
                return 1;
        }
+
+       if (raid_disks && raid_disks < array.raid_disks && array.level > 1 &&
+           get_linux_version() < 2006032 &&
+           !check_env("MDADM_FORCE_FEWER")) {
+               fprintf(stderr, Name ": reducing the number of devices is not safe before Linux 2.6.32\n"
+                       "       Please use a newer kernel\n");
+               return 1;
+       }
        sra = sysfs_read(fd, 0, GET_LEVEL);
        frozen = freeze_array(sra);
        if (frozen < 0) {
@@ -627,7 +635,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                                        }
                                }
                                if (raid_disks)
-                                       /* The find raid6->raid5 conversion
+                                       /* The final raid6->raid5 conversion
                                         * will reduce the number of disks,
                                         * so now we need to aim higher
                                         */