]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Grow.c
mdadm: block update=ppl for non raid456 levels
[thirdparty/mdadm.git] / Grow.c
diff --git a/Grow.c b/Grow.c
index 8a242b0f8725e2a3add42b26720e2cbc764e005d..8c520d428ed24a6d3b46fa645dd2f7771445ddc7 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1892,6 +1892,14 @@ int Grow_reshape(char *devname, int fd,
 
                if (retval) {
                        pr_err("Cannot read superblock for %s\n", devname);
+                       close(cfd);
+                       free(subarray);
+                       return 1;
+               }
+
+               if (s->raiddisks && subarray) {
+                       pr_err("--raid-devices operation can be performed on a container only\n");
+                       close(cfd);
                        free(subarray);
                        return 1;
                }
@@ -2936,7 +2944,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
        }
 
        md_get_array_info(fd, &array);
-       if (level == 0 && (array.level >= 4 && array.level <= 6)) {
+       if (level == 0 && is_level456(array.level)) {
                /* To convert to RAID0 we need to fail and
                 * remove any non-data devices. */
                int found = 0;