Blob Blame History Raw
From 25eaee83b236d1761a317d52bd4dd084275860a7 Mon Sep 17 00:00:00 2001
From: Kaushal M <kaushal@redhat.com>
Date: Fri, 10 Jul 2015 14:50:29 +0530
Subject: [PATCH 229/234] glusterd: Send friend update even for EVENT_RCVD_ACC

In a multi-network cluster, a new peer being probed into the cluster
will not get all the addresses of the peer that initiated the probe in
some cases as it doesn't recieve friend updates from other peers in the
cluster.

This happens when the new peer establishes connection with the other
peers before the other peers connect to the new peer.

Assuming, F is the initiator peer, O is one of the other peers in the
cluster and N is the new peer, the following series of events occur on O
when N establishes the connection first. N is already in the BEFRIENDED
state on O, and the actions happening will refer the BEFRIENDED state
table.

  EVENT_RCV_FRIEND_REQ -> results in handle_friend_add_req being called
                          which injects a LOCAL_ACC
  EVENT_RCVC_LOCAL_ACC -> results in send_friend_update being called
                          which should have sent an update to N, but O
                          has still not established a connection to N,
                          so the update isn't sent
  EVENT_CONNECTED      -> O now connects to N, this results in O sending a
                          friend_add req to N
  EVENT_RCVD_ACC       -> friend_add_cbk inject this event, but this event
                          results in a NOOP when in BEFRIENDED

As a result this O doesn't recieve all the addresses of F. If the
cluster contains any volumes with bricks attached to the missing
addresses of F and O is restarted in this condition, GlusterD will fail
to start as it wouldn't be able to resolve those bricks.

This commit changes the EVENT_RCVD_ACC action for the BEFRIENDED state
from a NOOP to send_friend_update. This makes sure that the new peer
recieves the updates from the other existing peers, irrespective of who
establishes the connection first, thus solving the problem.

BUG: 1234725
Change-Id: I2bfb7f5e9456a792a15f09bd1ca58f6dc8f2fc1a
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-upstream-on: https://review.gluster.org/11625
Reviewed-on: https://code.engineering.redhat.com/gerrit/52812
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-sm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 902e770..e8e9b3a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -1024,7 +1024,7 @@ glusterd_sm_t  glusterd_state_befriended [] = {
         {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_none}, //EVENT_NONE,
         {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_none}, //EVENT_PROBE,
         {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_none}, //EVENT_INIT_FRIEND_REQ,
-        {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_none}, //EVENT_RCVD_ACC
+        {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_send_friend_update}, //EVENT_RCVD_ACC
         {GD_FRIEND_STATE_BEFRIENDED, glusterd_ac_send_friend_update}, //EVENT_RCVD_LOCAL_ACC
         {GD_FRIEND_STATE_REJECTED, glusterd_ac_none}, //EVENT_RCVD_RJT
         {GD_FRIEND_STATE_REJECTED, glusterd_ac_none}, //EVENT_RCVD_LOCAL_RJT
-- 
1.7.1