[PATCH 2/2] Cpg join with undelivered leave message

Jan Friesse jfriesse at redhat.com
Mon Mar 1 09:10:54 PST 2010


Patch handles situation, when on one node, one process:
- join cpg
- do same actions
- leave cpg
- join cpg again

Following sequence can (racy) end with broken process_info list.

To solve this problem, one more check is done in
message_handler_req_lib_cpg_join so if process_info with same pid and
group as new join request exists, CPG_ERR_TRY_AGAIN is returned.
---
 branches/whitetank/exec/cpg.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/branches/whitetank/exec/cpg.c b/branches/whitetank/exec/cpg.c
index 7a61f1a..bc68213 100644
--- a/branches/whitetank/exec/cpg.c
+++ b/branches/whitetank/exec/cpg.c
@@ -969,6 +969,21 @@ static void message_handler_req_lib_cpg_join (void *conn, void *message)
 		}
 	}
 
+	/*
+	 * Same check must be done in process info list, because there may be not yet delivered
+	 * leave of client.
+	 */
+	for (iter = process_info_list_head.next; iter != &process_info_list_head; iter = iter->next) {
+		struct process_info *pi = list_entry (iter, struct process_info, list);
+
+		if (pi->nodeid == totempg_my_nodeid_get () && pi->pid == req_lib_cpg_join->pid &&
+		    mar_name_compare(&req_lib_cpg_join->group_name, &pi->group) == 0) {
+			/* We have same pid and group name joined -> return error */
+			error = CPG_ERR_TRY_AGAIN;
+			goto response_send;
+		}
+	}
+
 	switch (cpd->cpd_state) {
 	case CPD_STATE_UNJOINED:
 		error = CPG_OK;
-- 
1.5.5.6


--------------000205060808000906040704--


More information about the Openais mailing list