dlm: master - dlm_controld: fix save_plocks initialization

David Teigland teigland at fedoraproject.org
Fri Aug 13 17:01:57 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=cad14d81f7f4a6adbdf762d7775c52f95807eae2
Commit:        cad14d81f7f4a6adbdf762d7775c52f95807eae2
Parent:        82afe0498f9176d0cc2a95c85437eea8f4ad965f
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Thu Aug 12 15:37:23 2010 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Fri Aug 13 12:00:05 2010 -0500

dlm_controld: fix save_plocks initialization

When dlm_controld joins a cpg and begins receiving plock messages, it
needs to save all those plock messages for processing after it initializes
plock state from a checkpoint.  Instead of being initialized to 1,
saved_plocks started as 0 and was initialized to 1 shortly after the join.
This left a short span of time where a plock message could arrive and be
processed immediately instead of saved, which would cause the node's plock
state to be out of sync with the other nodes, which could lead to any
number of different problems with plocks.

bz 623810

Signed-off-by: David Teigland <teigland at redhat.com>
---
 group/dlm_controld/cpg.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index 93cf108..a9cc61e 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -1135,9 +1135,9 @@ static void receive_plocks_stored(struct lockspace *ls, struct dlm_header *hd,
 		return;
 	}
 
-	process_saved_plocks(ls);
 	ls->need_plocks = 0;
 	ls->save_plocks = 0;
+	process_saved_plocks(ls);
 }
 
 static void send_info(struct lockspace *ls, struct change *cg, int type,
@@ -1282,6 +1282,10 @@ static void prepare_plocks(struct lockspace *ls)
 		}
 		ls->plock_ckpt_node = our_nodeid;
 		ls->need_plocks = 0;
+		if (ls->save_plocks) {
+			ls->save_plocks = 0;
+			process_saved_plocks(ls);
+		}
 		return;
 	}
 
@@ -1294,7 +1298,10 @@ static void prepare_plocks(struct lockspace *ls)
 
 	if (!ls->plock_ckpt_node) {
 		ls->need_plocks = 0;
-		ls->save_plocks = 0;
+		if (ls->save_plocks) {
+			ls->save_plocks = 0;
+			process_saved_plocks(ls);
+		}
 		return;
 	}
 
@@ -1302,10 +1309,8 @@ static void prepare_plocks(struct lockspace *ls)
 	   existing plock state in the ckpt to the time that we read that state
 	   from the ckpt. */
 
-	if (ls->need_plocks) {
-		ls->save_plocks = 1;
+	if (ls->need_plocks)
 		return;
-	}
 
 	if (ls->plock_ckpt_node != our_nodeid)
 		return;
@@ -1783,6 +1788,7 @@ int dlm_join_lockspace(struct lockspace *ls)
 	ls->cpg_fd = fd;
 	ls->kernel_stopped = 1;
 	ls->need_plocks = 1;
+	ls->save_plocks = 1;
 	ls->joining = 1;
 
 	memset(&name, 0, sizeof(name));


More information about the cluster-commits mailing list