mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone
Blob Blame History Raw
From 36265f58ae0def19b2bbe55443d77a10bad8eeca Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 18 Sep 2019 12:42:50 +0200
Subject: [PATCH 4/6] pvmove: check if participating LV is already exlcusively
 active

When running pvmove, we need to decide whether pvmove has to be doing
exlusive or non-exclusive activations for LV.

Whenever LV that requires exlusive activation is present, it makes
pvmove exlusive. But when there is already activate i.e. linear LV
in exclusive mode it also needs to switch pvmove into 'exlusively
activating' pvmove.

(cherry picked from commit 1349b61bb72d3a42636053ede0d6fa71cd4f2d93)

Conflicts:
	WHATS_NEW
---
 WHATS_NEW      | 1 +
 tools/pvmove.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/WHATS_NEW b/WHATS_NEW
index d99f183..399864d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,6 +1,7 @@
 Version 2.02.187 - 
 ===================================
   Prevent creating VGs with PVs with different logical block sizes.
+  Pvmove runs in exlusively activating mode for exclusively active LVs.
 
 Version 2.02.186 - 27th August 2019
 ===================================
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 754bd58..3a447c4 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -674,7 +674,8 @@ static int _pvmove_setup_single(struct cmd_context *cmd,
 		dm_list_iterate_items(lvl, lvs_changed) {
 			lvh = lv_lock_holder(lvl->lv);
 			/* Exclusive LV decides whether pvmove must be also exclusive */
-			if (lv_is_origin(lvh) || seg_only_exclusive(first_seg(lvh)))
+			if (lv_is_origin(lvh) || seg_only_exclusive(first_seg(lvh)) ||
+			    lv_is_active_exclusive(lvh))
 				exclusive = 1;
 		}
 
-- 
1.8.3.1