[PATCH] CPG: Send CPG_REASON_PROCDOWN when really needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes the issue that in some cases where cpg_finalize()
was called just after cpg_leave() was called, CPG_REASON_PROCDOWN
might also be sent while CPG_REASON_LEAVE had already been sent.
This behavior is not aligned with what the man page has described:
"CPG_REASON_PROCDOWN - the process left a group without calling 
cpg_leave()."
And it will confuse CPG's clients in that one process left results
in two different reasons being sent.

The root cause of this issue is cpg_leave() will return after
adding the LEAVE message to the sending queue, but the cpg's group 
name has not been cleared yet. Just at that time, cpg_finalize()
is being called, then it determines if there is the calling of 
cpg_leave() happened only by the checking of cpg's group name, so
this method is not sufficient.

Signed-off-by: Jiaju Zhang <jjzhang@xxxxxxx>
---
 exec/cpg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/exec/cpg.c b/exec/cpg.c
index 0fdcc30..71ac908 100644
--- a/exec/cpg.c
+++ b/exec/cpg.c
@@ -920,7 +920,7 @@ static int cpg_lib_exit_fn (void *conn)
 
 	log_printf(LOGSYS_LEVEL_DEBUG, "exit_fn for conn=%p", conn);
 
-	if (cpd->group_name.length > 0) {
+	if (cpd->group_name.length > 0 && cpd->cpd_state != CPD_STATE_LEAVE_STARTED) {
 		cpg_node_joinleave_send (cpd->pid, &cpd->group_name,
 				MESSAGE_REQ_EXEC_CPG_PROCLEAVE, CONFCHG_CPG_REASON_PROCDOWN);
 	}









_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux