]> git.proxmox.com Git - mirror_corosync.git/commitdiff
CPG: Send CPG_REASON_PROCDOWN when really needed
authorJiaju Zhang <jjzhang@suse.de>
Sun, 5 Feb 2012 17:41:39 +0000 (01:41 +0800)
committerSteven Dake <sdake@redhat.com>
Mon, 6 Feb 2012 15:07:54 +0000 (08:07 -0700)
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@suse.de>
Reviewed-by: Steven Dake <sdake@redhat.com>
exec/cpg.c

index 0fdcc30519c7394a1588e984c41054e09057dd6c..71ac908441affe90b70503fc6d7e4267608b3449 100644 (file)
@@ -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);
        }