]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: fix check for raid6 layout normalization
authorDan Williams <dan.j.williams@intel.com>
Thu, 18 Nov 2010 09:22:09 +0000 (10:22 +0100)
committerNeilBrown <neilb@suse.de>
Tue, 23 Nov 2010 04:11:37 +0000 (15:11 +1100)
If the user does not specify a layout, don't skip asking about retaining
the non-standard raid6 layout which may be implicitly changed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index b65cbcbd104b928600691d6b73270b90b7b5fece..abbb3d9e8b79ff4c6cc7d1b51e040109c5276a75 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -733,9 +733,9 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
 
        /* ========= set shape (chunk_size / layout / ndisks)  ============== */
        /* Check if layout change is a no-op */
-       if (layout_str) switch(array.level) {
+       switch(array.level) {
        case 5:
-               if (array.layout == map_name(r5layout, layout_str))
+               if (layout_str && array.layout == map_name(r5layout, layout_str))
                        layout_str = NULL;
                break;
        case 6:
@@ -751,8 +751,9 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        rv = 1;
                        goto release;
                }
-               if (strcmp(layout_str, "normalise") == 0 ||
-                   strcmp(layout_str, "normalize") == 0) {
+               if (layout_str &&
+                   (strcmp(layout_str, "normalise") == 0 ||
+                    strcmp(layout_str, "normalize") == 0)) {
                        char *hyphen;
                        strcpy(alt_layout, map_num(r6layout, array.layout));
                        hyphen = strrchr(alt_layout, '-');
@@ -762,7 +763,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        }
                }
 
-               if (array.layout == map_name(r6layout, layout_str))
+               if (layout_str && array.layout == map_name(r6layout, layout_str))
                        layout_str = NULL;
                if (layout_str && strcmp(layout_str, "preserve") == 0)
                        layout_str = NULL;