]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
revert-reshape: make sure reshape_position is acceptable.
[thirdparty/mdadm.git] / super0.c
index ff4c657c223ca28c9aeea157335b0c4e1ef69afd..b2019dfaff2a152da26ed96c9d816cb73954e0f7 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -654,7 +654,16 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                               devname);
                else {
                        int tmp;
+                       int parity = sb->level == 6 ? 2 : 1;
                        rv = 0;
+
+                       if (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 as stop again\n");
+                               return -2;
+                       }
                        sb->raid_disks -= sb->delta_disks;
                        sb->delta_disks = -sb->delta_disks;