From c76df666c903b59f069292c4c1507b1ac37a5590 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Fri, 29 Apr 2016 19:49:21 +0100 Subject: [PATCH] raid: Use inherited tags when wiping rmeta. If there's an activation volume_filter, it might not be possible to activate the rmeta LVs to wipe them. At least inherit any LV tags from the parent LV while attempting this. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 55ecb68b0..a712c5f20 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.152 - ================================== + Use any inherited tags when wiping metadata sub LVs to ensure activation. Add str_list_wipe. Improve support for interrupting procesing of volumes during lvchange. Use failed command return code when lvchanging read-only volume. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 4bce8085d..cd0a78cdf 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -3834,6 +3834,16 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah, return 0; } lv_set_visible(meta_lv); + + /* + * Copy any tags from the new LV to the metadata LV so + * it can be activated temporarily. + */ + if (!str_list_dup(meta_lv->vg->vgmem, &meta_lv->tags, &lv->tags)) { + log_error("Failed to copy tags onto LV %s to clear metadata.", display_lvname(meta_lv)); + return 0; + } + clear_metadata = 1; } @@ -3882,6 +3892,9 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah, return 0; } lv_set_hidden(meta_lv); + + /* Wipe any temporary tags required for activation. */ + str_list_wipe(&meta_lv->tags); } } -- 2.43.5