Blame SOURCES/lvm2-2_02_187-raid-better-place-for-blocking-reshapes.patch

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