dlm: master - dlm_controld: wait on different quorum conditions

David Teigland teigland at fedoraproject.org
Fri Jan 6 20:07:53 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=1498ce20c091845100456fd1f235658f6056d140
Commit:        1498ce20c091845100456fd1f235658f6056d140
Parent:        a75ba5bf6afb3cf6bd31493b1e6c8815cda19c3c
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Thu Jan 5 14:22:23 2012 -0600
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Thu Jan 5 14:22:23 2012 -0600

dlm_controld: wait on different quorum conditions

enable_quorum option can be 0, 1, 2 to wait for quorum
never, only before fencing request, and always.
---
 dlm_controld/cpg.c        |   57 +++++++++++++++++++++++----------------------
 dlm_controld/dlm_daemon.h |    2 +-
 2 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/dlm_controld/cpg.c b/dlm_controld/cpg.c
index e64bf54..183879e 100644
--- a/dlm_controld/cpg.c
+++ b/dlm_controld/cpg.c
@@ -682,25 +682,6 @@ static void request_fencing(struct lockspace *ls)
 	}
 }
 
-/* we know that the quorum value here is consistent with the cpg events
-   because the ringid's are in sync per the previous check_ringid_done */
-
-static int check_quorum_done(struct lockspace *ls)
-{
-	if (!cfgd_enable_quorum) {
-		log_group(ls, "check_quorum disabled");
-		return 1;
-	}
-
-	if (!cluster_quorate) {
-		log_group(ls, "check_quorum not quorate");
-		return 0;
-	}
-
-	log_group(ls, "check_quorum done");
-	return 1;
-}
-
 /* wait for local fs_controld to ack each failed node */
 
 static int check_fs_done(struct lockspace *ls)
@@ -709,10 +690,8 @@ static int check_fs_done(struct lockspace *ls)
 	int wait_count = 0;
 
 	/* no corresponding fs for this lockspace */
-	if (!ls->fs_registered) {
-		log_group(ls, "check_fs none registered");
+	if (!ls->fs_registered)
 		return 1;
-	}
 
 	list_for_each_entry(node, &ls->node_history, list) {
 		if (!node->check_fs)
@@ -827,19 +806,41 @@ static void stop_kernel(struct lockspace *ls, uint32_t seq)
    that have occured since the last change applied to dlm-kernel, not
    just the latest change */
 
+/* we know that the cluster_quorate value here is consistent with the cpg events
+   because the ringid's are in sync per the check_ringid_done */
+
+/*
+   enable_quorum = 0
+	Never wait for quorum here.
+
+   enable_quorum = 1
+	Wait for quorum before calling request_fencing() in cases where
+	fencing is needed.  Reason for using this would be if fencing
+	system doesn't wait for quorum before carrying out a fencing
+	request, and we want to avoid having partitioned inquorate nodes
+	fencing quorate nodes in another partition.
+	   
+   enable_quorum = 2
+	Always wait for quorum as a general condition here. This
+	means that lockspace join/leave operations would block waiting
+	for quorum.  There's not any reason to do this per se, unless
+	that's the behavior the application using the dlm wants.
+*/
+
 static int wait_conditions_done(struct lockspace *ls)
 {
 	if (!check_ringid_done(ls))
 		return 0;
 
-	/* It's convenient to be able to join and leave lockspaces without
-	   having quorum.  If the fencing system does not wait for quorum
-	   before carrying out fencing requests, then we may want to wait for
-	   quorum here before requesting fencing, to avoid having partitioned
-	   nodes fence good nodes. */
+	if ((cfgd_enable_quorum > 1) && !cluster_quorate) {
+		log_group(ls, "wait for quorum");
+		return 0;
+	}
 
-	if (need_fencing(ls) && !check_quorum_done(ls))
+	if ((cfgd_enable_quorum > 0) && need_fencing(ls) && !cluster_quorate) {
+		log_group(ls, "wait for quorum before fencing");
 		return 0;
+	}
 
 	request_fencing(ls);
 
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 03adb3c..2d27caa 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -81,7 +81,7 @@
 
 #define DEFAULT_DEBUG_LOGFILE 0
 #define DEFAULT_ENABLE_FENCING 1
-#define DEFAULT_ENABLE_QUORUM 1
+#define DEFAULT_ENABLE_QUORUM 0
 #define DEFAULT_ENABLE_FSCONTROL 0
 #define DEFAULT_ENABLE_PLOCK 1
 #define DEFAULT_PLOCK_DEBUG 0


More information about the cluster-commits mailing list