From d51bff87b7723a61057fcabc743f9afbdbfa37fe Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 13 Jun 2022 11:14:49 +0200 Subject: [PATCH] 4.14-stable patches added patches: md-raid0-ignore-raid0-layout-if-the-second-zone-has-only-one-device.patch --- ...-the-second-zone-has-only-one-device.patch | 72 +++++++++++++++++++ queue-4.14/series | 1 + 2 files changed, 73 insertions(+) create mode 100644 queue-4.14/md-raid0-ignore-raid0-layout-if-the-second-zone-has-only-one-device.patch diff --git a/queue-4.14/md-raid0-ignore-raid0-layout-if-the-second-zone-has-only-one-device.patch b/queue-4.14/md-raid0-ignore-raid0-layout-if-the-second-zone-has-only-one-device.patch new file mode 100644 index 00000000000..dcd4f0dc6cd --- /dev/null +++ b/queue-4.14/md-raid0-ignore-raid0-layout-if-the-second-zone-has-only-one-device.patch @@ -0,0 +1,72 @@ +From ea23994edc4169bd90d7a9b5908c6ccefd82fa40 Mon Sep 17 00:00:00 2001 +From: Pascal Hambourg +Date: Wed, 13 Apr 2022 08:53:56 +0200 +Subject: md/raid0: Ignore RAID0 layout if the second zone has only one device + +From: Pascal Hambourg + +commit ea23994edc4169bd90d7a9b5908c6ccefd82fa40 upstream. + +The RAID0 layout is irrelevant if all members have the same size so the +array has only one zone. It is *also* irrelevant if the array has two +zones and the second zone has only one device, for example if the array +has two members of different sizes. + +So in that case it makes sense to allow assembly even when the layout is +undefined, like what is done when the array has only one zone. + +Reviewed-by: NeilBrown +Signed-off-by: Pascal Hambourg +Signed-off-by: Song Liu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/raid0.c | 31 ++++++++++++++++--------------- + 1 file changed, 16 insertions(+), 15 deletions(-) + +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -150,21 +150,6 @@ static int create_strip_zones(struct mdd + pr_debug("md/raid0:%s: FINAL %d zones\n", + mdname(mddev), conf->nr_strip_zones); + +- 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; +- } else { +- pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n", +- mdname(mddev)); +- pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n"); +- err = -ENOTSUPP; +- goto abort; +- } + /* + * now since we have the hard sector sizes, we can make sure + * chunk size is a multiple of that sector size +@@ -293,6 +278,22 @@ static int create_strip_zones(struct mdd + (unsigned long long)smallest->sectors); + } + ++ if (conf->nr_strip_zones == 1 || conf->strip_zone[1].nb_dev == 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; ++ } else { ++ pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n", ++ mdname(mddev)); ++ pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n"); ++ err = -EOPNOTSUPP; ++ goto abort; ++ } ++ + pr_debug("md/raid0:%s: done.\n", mdname(mddev)); + *private_conf = conf; + diff --git a/queue-4.14/series b/queue-4.14/series index 768a6b54cb3..31d6f6f18a4 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -213,3 +213,4 @@ ixgbe-fix-bcast-packets-rx-on-vf-after-promisc-removal.patch ixgbe-fix-unexpected-vlan-rx-in-promisc-mode-on-vf.patch input-bcm5974-set-missing-urb_no_transfer_dma_map-urb-flag.patch powerpc-32-fix-overread-overwrite-of-thread_struct-via-ptrace.patch +md-raid0-ignore-raid0-layout-if-the-second-zone-has-only-one-device.patch -- 2.47.3