summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2020-02-07 15:14:05 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2020-02-07 16:48:48 +0100
commit96985b1373d58b411a80c2985f348466e78cbe6e (patch)
tree0c464edc84182af639bf35da2466008c79c0d595
parentffea7daec3d09fb4315104bb346cfa9d6db6f9e9 (diff)
downloadlvm2-96985b1373d58b411a80c2985f348466e78cbe6e.tar.gz
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).
-rw-r--r--lib/metadata/raid_manip.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index dfc6fe532..fa1b91a7e 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2298,6 +2298,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;
@@ -6216,12 +6223,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),