From ac36153e99438db64d34c79430a40131f8c07054 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 14 Aug 2023 15:43:48 +0200 Subject: [PATCH] lvconvert: preserve UUID for swapped metadata When swapping metadata LV for a pool volume, preserve UUID for metadata LV during the swap - this allows to better utilise locks with lvmlockd. --- tools/lvconvert.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 49047abb0..953dea8a2 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2955,20 +2955,8 @@ static int _lvconvert_swap_pool_metadata(struct cmd_context *cmd, if (!detach_pool_metadata_lv(seg, &prev_metadata_lv)) return_0; - swap_name = metadata_lv->name; - - if (!lv_rename_update(cmd, metadata_lv, "pvmove_tmeta", 0)) - return_0; - - /* Give the previous metadata LV the name of the LV replacing it. */ - - if (!lv_rename_update(cmd, prev_metadata_lv, swap_name, 0)) - return_0; - - /* Rename deactivated metadata LV to have _tmeta suffix */ - - if (!lv_rename_update(cmd, metadata_lv, meta_name, 0)) - return_0; + if (!swap_lv_identifiers(cmd, metadata_lv, prev_metadata_lv)) + return_0; if (!attach_pool_metadata_lv(seg, metadata_lv)) return_0;