From a2836f12c4c45738b495403a91a0f0db2e88e0cb Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 27 Jun 2013 16:38:53 +1000 Subject: 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 --- super0.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'super0.c') 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; -- cgit v1.2.3