You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

From 56474336821cf703073bd0d82f9428697b85ec29 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 7 Feb 2020 15:14:05 +0100
Subject: [PATCH] raid: better place for blocking reshapes
Still the place can be better to block only particular reshape
operations which ATM cause kernel problems.
We check if the new number of images is higher - and prevent to take
conversion if the volume is in use (i.e. thin-pool's data LV).
(cherry picked from commit 96985b1373d58b411a80c2985f348466e78cbe6e)
(cherry picked from commit 253d10f840682f85dad0e4c29f55ff50f94792fa)
---
lib/metadata/raid_manip.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 7481ebf..eae0a8d 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2299,6 +2299,13 @@ static int _raid_reshape(struct logical_volume *lv,
if ((new_image_count = new_stripes + seg->segtype->parity_devs) < 2)
return_0;
+ /* FIXME Can't reshape volume in use - aka not toplevel devices */
+ if (old_image_count < new_image_count &&
+ !dm_list_empty(&seg->lv->segs_using_this_lv)) {
+ log_error("Unable to convert stacked volume %s.", display_lvname(seg->lv));
+ return 0;
+ }
+
if (!_check_max_raid_devices(new_image_count))
return_0;
@@ -6218,12 +6225,6 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
if (!(*segtype = get_segtype_from_flag(cmd, seg_flag)))
return_0;
- /* FIXME Can't reshape volume in use - aka not toplevel devices */
- if (!dm_list_empty(&seg_from->lv->segs_using_this_lv)) {
- log_error("Can't reshape stacked volume %s.", display_lvname(seg_from->lv));
- return 0;
- }
-
if (segtype_sav != *segtype) {
log_warn("Replaced LV type %s%s with possible type %s.",
segtype_sav->name, _get_segtype_alias_str(seg_from->lv, segtype_sav),
--
1.8.3.1