Skip to contentSkip to conversation

master - pvmove: fix activation order

PATCH Zdenek Kabelac 1 participant 1 message Dec 11, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3903f915f83634f91946550fda85d60b72ce3a88
Commit:        3903f915f83634f91946550fda85d60b72ce3a88
Parent:        67f9e6b175815d7a91a10ecc3d5098d30dbfed91
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sun Dec 11 14:26:17 2016 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sun Dec 11 23:22:36 2016 +0100

pvmove: fix activation order

For proper locking we need to gain lock first for mirror which needs to be deactivated later to be working in cluster.

---
 WHATS_NEW           |    1 +
 tools/pvmove_poll.c |   10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
WHATS_NEW +1 -0
index 63cdb89..ea15903 100644
@@ -1,5 +1,6 @@
 Version 2.02.169 - 
 =====================================
+  Fix pvmove leaving -pvmove0 error device in clustered VG.
   Avoid adding extra '_' at end of raid extracted images or metadata.
   Optimize another _rmeta clearing code.
   Fix deactivation of raid orphan devices for clustered VG.
tools/pvmove_poll.c +5 -5
index ea4be24..2cd746b 100644
@@ -157,17 +157,17 @@ int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg,
 		return 0;
 	}
 
+	/* Unsuspend LVs */
+	if (!resume_lvs(cmd, lvs_changed))
+		stack;
+
 	/* Release mirror LV.  (No pending I/O because it's been suspended.) */
-	if (!resume_lv(cmd, lv_mirr)) {
+	if (!activate_lv_excl_local(cmd, lv_mirr)) {
 		log_error("Unable to reactivate logical volume \"%s\"",
 			  lv_mirr->name);
 		r = 0;
 	}
 
-	/* Unsuspend LVs */
-	if (!resume_lvs(cmd, lvs_changed))
-		stack;
-
 	/* Deactivate mirror LV */
 	if (!deactivate_lv(cmd, lv_mirr)) {
 		log_error("ABORTING: Unable to deactivate temporary logical "