summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-sm.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-03-14 14:16:08 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-14 03:34:52 -0700
commitc0b3ba9b3b65de88628a36cc51d2864ec72de0d0 (patch)
treefc60da962998cb0ca0f50aee6bf99186ed2b279f /xlators/mgmt/glusterd/src/glusterd-sm.c
parent404e8f27d3a9e950173e02151eccbb792615e535 (diff)
glusterd: Checked if peer is connected and 'handshaked' before sending updates
Change-Id: Ia57378d5c81b263d6fcbc9d54ccc7fb138d83d8e BUG: 801731 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/2941 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 5376c5b6b08..72af8c05b57 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -445,19 +445,15 @@ out:
}
static gf_boolean_t
-glusterd_is_valid_recipient_peer (glusterd_peerinfo_t *peerinfo,
- glusterd_peerinfo_t *cur_peerinfo)
+glusterd_should_update_peer (glusterd_peerinfo_t *peerinfo,
+ glusterd_peerinfo_t *cur_peerinfo)
{
gf_boolean_t is_valid = _gf_false;
- if (peerinfo == cur_peerinfo)
+ if ((peerinfo == cur_peerinfo) ||
+ (peerinfo->state.state == GD_FRIEND_STATE_BEFRIENDED))
is_valid = _gf_true;
- else if (peerinfo->connected && peerinfo->peer &&
- peerinfo->state.state == GD_FRIEND_STATE_BEFRIENDED)
- is_valid = _gf_true;
-
-
return is_valid;
}
@@ -496,7 +492,7 @@ glusterd_ac_send_friend_update (glusterd_friend_sm_event_t *event, void *ctx)
goto out;
list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
- if (!glusterd_is_valid_recipient_peer (peerinfo, cur_peerinfo))
+ if (!glusterd_should_update_peer (peerinfo, cur_peerinfo))
continue;
count++;
@@ -518,7 +514,10 @@ glusterd_ac_send_friend_update (glusterd_friend_sm_event_t *event, void *ctx)
goto out;
list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
- if (!glusterd_is_valid_recipient_peer (peerinfo, cur_peerinfo))
+ if (!peerinfo->connected || !peerinfo->peer)
+ continue;
+
+ if (!glusterd_should_update_peer (peerinfo, cur_peerinfo))
continue;
ret = dict_set_static_ptr (friends, "peerinfo", peerinfo);