Skip to contentSkip to conversation

master - pvmove: support properly subLV locking

PATCH Zdenek Kabelac 1 participant 1 message Apr 20, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ace97c9f9cdc6f0bfd33ae465404169a33953c1e
Commit:        ace97c9f9cdc6f0bfd33ae465404169a33953c1e
Parent:        7a7b8a7778aace88c967ee8285485c494ce1f3f8
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Mar 27 21:08:40 2018 +0200
Committer:     Zdenek Kabelac <[email protected]>
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(-)
tools/pvmove.c +9 -4
index 2a26a10..84efdf4 100644
@@ -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);