]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Incremental: don't abort container if one member explicitly disabled.
[thirdparty/mdadm.git] / super0.c
index ff4c657c223ca28c9aeea157335b0c4e1ef69afd..3218377f74f4d72e12b4a6f4559d8041264ff0c6 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -650,11 +650,21 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                        pr_err("No active reshape to revert on %s\n",
                               devname);
                else if (sb->delta_disks == 0)
-                       pr_err("%s: Can on revert reshape which changes number of devices\n",
+                       pr_err("%s: Can only revert reshape which changes number of devices\n",
                               devname);
                else {
                        int tmp;
+                       int parity = sb->level == 6 ? 2 : 1;
                        rv = 0;
+
+                       if (sb->level >= 4 && sb->level <= 6 &&
+                           sb->reshape_position % (
+                                   sb->new_chunk/512 *
+                                   (sb->raid_disks - sb->delta_disks - parity))) {
+                               pr_err("Reshape position is not suitably aligned.\n");
+                               pr_err("Try normal assembly and stop again\n");
+                               return -2;
+                       }
                        sb->raid_disks -= sb->delta_disks;
                        sb->delta_disks = -sb->delta_disks;
 
@@ -1264,7 +1274,7 @@ static int validate_geometry0(struct supertype *st, int level,
                               "%d terabytes per device\n", tbmax);
                return 0;
        }
-       if (chunk && *chunk == UnSet)
+       if (*chunk == UnSet)
                *chunk = DEFAULT_CHUNK;
 
        if (!subdev)