diff options
author | NeilBrown <neilb@suse.de> | 2019-09-09 08:52:29 +0200 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2019-09-13 22:10:06 +0200 |
commit | 33f2c35a54dfd75ad0e7e86918dcbe4de799a56c (patch) | |
tree | bb6125970eda98dfc945d1060cfe91ea676f4f7e /drivers/md/raid0.c | |
parent | md/raid0: avoid RAID0 data corruption due to layout confusion. (diff) | |
download | linux-33f2c35a54dfd75ad0e7e86918dcbe4de799a56c.tar.xz linux-33f2c35a54dfd75ad0e7e86918dcbe4de799a56c.zip |
md: add feature flag MD_FEATURE_RAID0_LAYOUT
Due to a bug introduced in Linux 3.14 we cannot determine the
correctly layout for a multi-zone RAID0 array - there are two
possibilities.
It is possible to tell the kernel which to chose using a module
parameter, but this can be clumsy to use. It would be best if
the choice were recorded in the metadata.
So add a feature flag for this purpose.
If it is set, then the 'layout' field of the superblock is used
to determine which layout to use.
If this flag is not set, then mddev->layout gets set to -1,
which causes the module parameter to be required.
Acked-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index ec611abda835..f61693e59684 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -145,6 +145,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) if (conf->nr_strip_zones == 1) { conf->layout = RAID0_ORIG_LAYOUT; + } else if (mddev->layout == RAID0_ORIG_LAYOUT || + mddev->layout == RAID0_ALT_MULTIZONE_LAYOUT) { + conf->layout = mddev->layout; } else if (default_layout == RAID0_ORIG_LAYOUT || default_layout == RAID0_ALT_MULTIZONE_LAYOUT) { conf->layout = default_layout; |