Skip to contentSkip to conversation

master - activation: improve activation

PATCH Zdenek Kabelac 1 participant 1 message Nov 1, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9f6209b878fb5b33dae5bc52a7ea47a9de9ff900
Commit:        9f6209b878fb5b33dae5bc52a7ea47a9de9ff900
Parent:        c3e674ad3010d21dc2cbde27b7634f7ea4fe67e3
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Nov 1 10:31:31 2013 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Nov 1 13:03:50 2013 +0100

activation: improve activation

This patch fixes mostly cluster behavior but also updates
non-cluster reaction where calls like 'lvchange -aln'
lead to incorrect errors for some segment types.

Fix the implicit activation rules where some segment types could be activated only in exclusive mode in cluster.
lvm2 command was not preserver 'local' property and incorrectly converted local activations in to plain exclusive, so the local activation could have activate volumes exclusively, but remotely.

---
 WHATS_NEW               |    1 +
 lib/metadata/lv.c       |   63 ++++++++++++++++++++++++++++++++---------------
 lib/metadata/lv_manip.c |   10 +++----
 3 files changed, 48 insertions(+), 26 deletions(-)
WHATS_NEW +1 -0
index ff8da1d..f0a764b 100644
@@ -1,5 +1,6 @@
 Version 2.02.104 -
 ===================================
+  Fix and improve logic for implicitely exclusive activations.
   Return success when LV cannot be activated because of volume_list filter.
   Return proper error state for remote exclusive activation.
   Fix missing lvmetad scan for PVs found on MD partitions.
lib/metadata/lv.c +43 -20

82 lines not on this page · raw message

lib/metadata/lv_manip.c +4 -6
index 020b365..4a224e4 100644
@@ -2892,8 +2892,8 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
 				continue;
 			}
 
-			/* For clearing, simply activate exclusive locally */
-			if (!activate_lv_excl_local(meta_lv->vg->cmd, meta_lv)) {
+			/* For clearing, simply activate locally */
+			if (!activate_lv_local(meta_lv->vg->cmd, meta_lv)) {
 				log_error("Failed to activate %s/%s for clearing",
 					  meta_lv->vg->name, meta_lv->name);
 				return 0;
@@ -6046,7 +6046,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
 				stack;
 				goto revert_new_lv;
 			}
-			if (!activate_lv_excl(cmd, lv)) {
+			if (!lv_active_change(cmd, lv, lp->activate)) {
 				log_error("Failed to activate thin %s.", lv->name);
 				goto deactivate_and_revert_new_lv;
 			}
@@ -6057,9 +6057,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
 				  "exception store.");
 			goto revert_new_lv;
 		}
-	} else if ((lp->activate == CHANGE_AY && !activate_lv(cmd, lv)) ||
-		   (lp->activate == CHANGE_AE && !activate_lv_excl(cmd, lv)) ||
-		   (lp->activate == CHANGE_ALY && !activate_lv_local(cmd, lv))) {
+	} else if (!lv_active_change(cmd, lv, lp->activate)) {
 		log_error("Failed to activate new LV.");
 		if (lp->zero)
 			goto deactivate_and_revert_new_lv;