From 4d45302e25f5fe1251bdd8f2c49c4a75a4a31d2e Mon Sep 17 00:00:00 2001 From: Jonathan Brassow Date: Fri, 15 Aug 2014 21:15:34 -0500 Subject: [PATCH] RAID: Fail RAID4/5/6 creation if PE size is less than STRIPE_SIZE_MIN The maximum stripe size is equal to the volume group PE size. If that size falls below the STRIPE_SIZE_MIN, the creation of RAID 4/5/6 volumes becomes impossible. (The kernel will fail to load a RAID 4/5/6 mapping table with a stripe size less than STRIPE_SIZE_MIN.) So, we report an error if it is attempted. This is very rare because reducing the PE size down that far limits the size of the PV below that of modern devices. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index a5daf80f0..2e2a064a6 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.110 - ================================== + Cleanly error when creating RAID with stripe size < PAGE_SIZE. Print name of LV which on activation triggers delayed snapshot merge. Add lv_layout and lv_type LV reporting fields. Properly display lvs lv_attr volume type and target type bit for cache origin. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index d86bdc141..b2e927dee 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -6364,6 +6364,21 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, } if (lp->stripe_size > vg->extent_size) { + if (segtype_is_raid(lp->segtype) && + (vg->extent_size < STRIPE_SIZE_MIN)) { + /* + * FIXME: RAID will simply fail to load the table if + * this is the case, but we should probably + * honor the stripe minimum for regular stripe + * volumes as well. Avoiding doing that now + * only to minimize the change. + */ + log_error("The extent size in volume group %s is too" + " small to support striped RAID volumes.", + vg->name); + return NULL; + } + log_print_unless_silent("Reducing requested stripe size %s to maximum, " "physical extent size %s.", display_size(cmd, (uint64_t) lp->stripe_size),