diff options
author | NeilBrown <neilb@suse.de> | 2020-10-14 04:12:48 +0200 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2020-10-14 17:40:40 +0200 |
commit | 97b51a2c2d00b79a59f2a8e37134031b0c9e0223 (patch) | |
tree | 1958109eec5a7e8926e2ecfaac02a90ecd00187b /super1.c | |
parent | Check if other Monitor instance running before fork. (diff) | |
download | mdadm-97b51a2c2d00b79a59f2a8e37134031b0c9e0223.tar.xz mdadm-97b51a2c2d00b79a59f2a8e37134031b0c9e0223.zip |
Super1: allow RAID0 layout setting to be removed.
Once the RAID0 layout has been set, the RAID0 array cannot be assembled
on an older kernel which doesn't understand layouts.
This is an intentional safety feature, but sometimes people need the
ability to roll-back to a previously working configuration.
So add "--update=layout-unspecified" to remove RAID0 layout information
from the superblock.
Running "--assemble --update=layout-unspecified" will cause the assembly
the fail when run on a newer kernel, but will allow it to work on
an older kernel.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to '')
-rw-r--r-- | super1.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1551,11 +1551,15 @@ static int update_super1(struct supertype *st, struct mdinfo *info, else if (strcmp(update, "nofailfast") == 0) sb->devflags &= ~FailFast1; else if (strcmp(update, "layout-original") == 0 || - strcmp(update, "layout-alternate") == 0) { + strcmp(update, "layout-alternate") == 0 || + strcmp(update, "layout-unspecified") == 0) { if (__le32_to_cpu(sb->level) != 0) { pr_err("%s: %s only supported for RAID0\n", devname?:"", update); rv = -1; + } else if (strcmp(update, "layout-unspecified") == 0) { + sb->feature_map &= ~__cpu_to_le32(MD_FEATURE_RAID0_LAYOUT); + sb->layout = 0; } else { sb->feature_map |= __cpu_to_le32(MD_FEATURE_RAID0_LAYOUT); sb->layout = __cpu_to_le32(update[7] == 'o' ? 1 : 2); |