From b2f1254c14b7b86789e542be14041252a652eec2 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 6 Mar 2018 13:38:00 +0100 Subject: [PATCH] raid: move VG update after archiving happened Update of LV le_count needs to happen after archive(). --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 52cf4bc76..49b995e29 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.178 - ===================================== + Do not modify archived metadata when removing striped raid. Fix memleak on error path when obtaining lv_raid_data_offset. Fix compatibility size test of extended external origin. Add external_origin visiting in for_each_sub_lv(). diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 044214c54..88b0d9d93 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -6077,13 +6077,6 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, is_last_pool = 1; } - /* Special case removing a striped raid LV with allocated reshape space */ - if (seg && seg->reshape_len) { - if (!(seg->segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_STRIPED))) - return_0; - lv->le_count = seg->len = seg->area_len = seg_lv(seg, 0)->le_count * seg->area_count; - } - /* Used cache pool, COW or historical LV cannot be activated */ if (!lv_is_used_cache_pool(lv) && !lv_is_cow(lv) && !lv_is_historical(lv) && @@ -6097,6 +6090,13 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, if (!archive(vg)) return 0; + /* Special case removing a striped raid LV with allocated reshape space */ + if (seg && seg->reshape_len) { + if (!(seg->segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_STRIPED))) + return_0; + lv->le_count = seg->len = seg->area_len = seg_lv(seg, 0)->le_count * seg->area_count; + } + /* Clear thin pool stacked messages */ if (pool_lv && !pool_has_message(first_seg(pool_lv), lv, 0) && !update_pool_lv(pool_lv, 1)) { -- 2.43.5