From 22554c3ff0807f62f8fa71faab153958c475028b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 18 Mar 2021 13:15:44 +0100 Subject: lvremove: extra code for handling thinpool data Add some extra code to handle differently sized thin-pool from thin-pool data volume. ATM this can't really happen, but once we start to use multiple commits while resizing stacked LV, we may actually get into the position, where data LV has been already resized, but thin-pool stayed with old size. But for now - report difference as internal error. --- lib/metadata/lv_manip.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/metadata/lv_manip.c') diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 24a2816ef..803f76052 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -1605,6 +1605,21 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete) return_0; } + if (seg_is_thin_pool(seg)) { + /* For some segtypes the size may differ between the segment size and its layered LV + * i.e. thin-pool and tdata. + * + * This can get useful, when we will support multiple commits + * while resizing a stacked LV. + */ + if (seg->len != seg_lv(seg, 0)->le_count) { + seg->len = seg_lv(seg, 0)->le_count; + /* FIXME: ATM capture as error as it should not happen. */ + log_debug(INTERNAL_ERROR "Pool size mismatched data size for %s", + display_lvname(seg->lv)); + } + } + dm_list_del(&seg->list); reduction = seg->len; } else -- cgit v1.2.1