summaryrefslogtreecommitdiff
path: root/super0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-06-27 16:38:53 +1000
committerNeilBrown <neilb@suse.de>2013-06-27 16:38:53 +1000
commita2836f12c4c45738b495403a91a0f0db2e88e0cb (patch)
tree409246c412d6f5c0bb101f49d8bab0513ebe0cb4 /super0.c
parent240cb5a41ac51f3245adad7bb54afafc7d82559b (diff)
revert-reshape: make sure reshape_position is acceptable.
We can only revert a reshape if the reshape_position aligns properly for the old geometry. If it doesn't we just fail for now. Also fix a +/- error with updating raid_disks for super1.c Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/super0.c b/super0.c
index ff4c657c..b2019dfa 100644
--- 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;