]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: fix reshape from RAID5 to RAID1.
authorNeilBrown <neilb@suse.de>
Tue, 30 Oct 2012 02:34:54 +0000 (13:34 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 20 Nov 2012 01:06:34 +0000 (12:06 +1100)
Commit 5da9ab9874cb5896023afae1462550d83a869831
       Grow_reshape re-factor
in mdadm-3.2 broke conversion from RAID5 and RAID1 - and we
never noticed.

This fixes it.

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

diff --git a/Grow.c b/Grow.c
index 4de802995d8a5c17753c4d843a68538f9c56db7d..205110cc2f152016c52a2a2ed6481de972c65509 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1281,7 +1281,9 @@ char *analyse_change(struct mdinfo *info, struct reshape *re)
                                return "Cannot set raid_disk when "
                                        "converting RAID5->RAID1";
                        re->level = 1;
-                       break;
+                       re->backup_blocks = 0;
+                       info->new_chunk = 0;
+                       return NULL;
                default:
                        return "Impossible level change requested";
                }
diff --git a/sysfs.c b/sysfs.c
index a7ff38a4d85bc6da9602cf43f5538228e1c6daf9..b66cebf32a10f72a138b5c2a60e085816bcc216e 100644 (file)
--- a/sysfs.c
+++ b/sysfs.c
@@ -176,8 +176,10 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options)
        if (options & GET_CACHE) {
                strcpy(base, "stripe_cache_size");
                if (load_sys(fname, buf))
-                       goto abort;
-               sra->cache_size = strtoul(buf, NULL, 0);
+                       /* Probably level doesn't support it */
+                       sra->cache_size = 0;
+               else
+                       sra->cache_size = strtoul(buf, NULL, 0);
        }
        if (options & GET_MISMATCH) {
                strcpy(base, "mismatch_cnt");