From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lon Hohberger Date: Tue, 7 Dec 2010 10:13:01 -0500 Subject: [Cluster-devel] [PATCH] cman: Don't increment on LEAVING->MEMBER transition Message-ID: <1291734781-16774-1-git-send-email-lhh@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit If a node left the cluster prior using 'cman_tool leave', its internal state is set to NODESTATE_LEAVING. Ordinarily, during the transition from NODESTATE_LEAVING to NODESTATE_DEAD, the member count is decremented. However, it is possible to rejoin the cluster membership from the NODESTATE_LEAVING state. If this occurs, the cluster member count is incremented, but since the node never transitioned from LEAVING->DEAD, it was not previously decremented, causing an ever-increasing node count in 'cman_tool status'. This patch resolves the issue by not incrementing the member count during a LEAVING->MEMBER transition. Resolves: rhbz#649533 Signed-off-by: Lon Hohberger --- cman/daemon/commands.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index d4d9fd9..e62f33c 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -2245,10 +2245,13 @@ void add_ais_node(int nodeid, uint64_t incar, int total_members) if (node->state == NODESTATE_DEAD || node->state == NODESTATE_LEAVING) { gettimeofday(&node->join_time, NULL); + /* If a node rejoins before it completes a leave, + * we should not increment cluster_members */ + if (node->state != NODESTATE_LEAVING) + cluster_members++; node->incarnation = incar; node->state = NODESTATE_MEMBER; node->leave_reason = 0; - cluster_members++; recalculate_quorum(0, 0); } } -- 1.7.2.3