summaryrefslogtreecommitdiff
path: root/super1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-07-02 16:10:27 +1000
committerNeilBrown <neilb@suse.de>2013-07-02 16:10:27 +1000
commitefb3994e4829f35e74b422e61c37eba79561fd4c (patch)
treee4091d9739ba23e2d8d3c98eb40a5eff4a22080c /super1.c
parent4bffc964b9e4c91877d1a863b06cab4748732b15 (diff)
revert-reshape: only impose reshape_position tests on raid[456]
This test is irrelevant for RAID10, so restrict it to those levels in which it is meaningful. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/super1.c b/super1.c
index b6e1e919..04272057 100644
--- a/super1.c
+++ b/super1.c
@@ -1276,14 +1276,17 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
* So we reject a revert-reshape unless the
* alignment is good.
*/
- reshape_sectors = __le64_to_cpu(sb->reshape_position);
- reshape_chunk = __le32_to_cpu(sb->new_chunk);
- reshape_chunk *= __le32_to_cpu(sb->raid_disks) - __le32_to_cpu(sb->delta_disks) -
- (__le32_to_cpu(sb->level)==6 ? 2 : 1);
- if (reshape_sectors % reshape_chunk) {
- pr_err("Reshape position is not suitably aligned.\n");
- pr_err("Try normal assembly as stop again\n");
- return -2;
+ if (__le32_to_cpu(sb->level) >= 4 &&
+ __le32_to_cpu(sb->level) <= 6) {
+ reshape_sectors = __le64_to_cpu(sb->reshape_position);
+ reshape_chunk = __le32_to_cpu(sb->new_chunk);
+ reshape_chunk *= __le32_to_cpu(sb->raid_disks) - __le32_to_cpu(sb->delta_disks) -
+ (__le32_to_cpu(sb->level)==6 ? 2 : 1);
+ if (reshape_sectors % reshape_chunk) {
+ pr_err("Reshape position is not suitably aligned.\n");
+ pr_err("Try normal assembly as stop again\n");
+ return -2;
+ }
}
sb->raid_disks = __cpu_to_le32(__le32_to_cpu(sb->raid_disks) -
__le32_to_cpu(sb->delta_disks));