[lvm-devel] master - pvmove: support properly subLV locking

Zdenek Kabelac zkabelac at sourceware.org
Fri Apr 20 11:01:17 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ace97c9f9cdc6f0bfd33ae465404169a33953c1e
Commit:        ace97c9f9cdc6f0bfd33ae465404169a33953c1e
Parent:        7a7b8a7778aace88c967ee8285485c494ce1f3f8
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Tue Mar 27 21:08:40 2018 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Fri Apr 20 12:03:16 2018 +0200

pvmove: support properly subLV locking

Since we support snapshot of mirrors, we do need to properly check
for stacked lock holder - fixes problem of pvmove in cluster
with mirrors under snapshot.

WHATS_NEW for this patch goes with 'Restore pvmove support...'
---
 tools/pvmove.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/pvmove.c b/tools/pvmove.c
index 2a26a10..84efdf4 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -393,10 +393,15 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
 		}
 
 		seg = first_seg(lv);
-
-		/* Presence of exclusive LV decides whether pvmove must be also exclusive */
-		if ((seg_only_exclusive(seg) || lv_is_origin(lv) || lv_is_cow(lv)))
-			needs_exclusive = 1;
+		if (!needs_exclusive) {
+			/* Presence of exclusive LV decides whether pvmove must be also exclusive */
+			if (!seg_only_exclusive(seg)) {
+				holder = lv_lock_holder(lv);
+				if (seg_only_exclusive(first_seg(holder)) || lv_is_origin(holder) || lv_is_cow(holder))
+					needs_exclusive = 1;
+			} else
+				needs_exclusive = 1;
+		}
 
 		if (seg_is_raid(seg) || seg_is_mirrored(seg)) {
 			dm_list_init(&trim_list);




More information about the lvm-devel mailing list