summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2012-09-30 11:28:50 +0530
committerVijay Bellur <vbellur@redhat.com>2012-10-01 08:27:38 -0400
commitdd70d18f57f8f7fb3af2b59872f81aefc564c0b2 (patch)
tree6e0e1629ba61acf91eb6a67321cc4d0552e78725
parent2705a0ca836e75acd729de8d1fd8f5ec78bf9bb6 (diff)
mgmt/glusterd: Inject events only on first disconnect
Change-Id: I31a46186c7d519057992c6111528acc666babb28 BUG: 861596 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: https://code.engineering.redhat.com/gerrit/43 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 99680b74ffe..18652bb877b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2955,42 +2955,50 @@ glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
quorum_action = _gf_true;
peerinfo->quorum_action = _gf_false;
}
- peerinfo->connected = 0;
/*
local glusterd (thinks that it) is the owner of the cluster
lock and 'fails' the operation on the first disconnect from
a peer.
*/
- glusterd_get_lock_owner (&owner);
- if (!uuid_compare (conf->uuid, owner)) {
- ret = glusterd_op_sm_inject_event (GD_OP_EVENT_START_UNLOCK,
- NULL);
- if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Unable"
- " to enqueue cluster unlock event");
- break;
- }
+ if (peerinfo->connected) {
+ glusterd_get_lock_owner (&owner);
+ if (!uuid_compare (conf->uuid, owner)) {
+ ret = glusterd_op_sm_inject_event
+ (GD_OP_EVENT_START_UNLOCK,
+ NULL);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to enqueue cluster "
+ "unlock event");
+ }
+ break;
+ }
- peer_uuid = GF_CALLOC (1, sizeof (*peer_uuid), gf_common_mt_char);
- if (!peer_uuid) {
- ret = -1;
- break;
- }
+ peer_uuid = GF_CALLOC (1, sizeof (*peer_uuid),
+ gf_common_mt_char);
+ if (!peer_uuid) {
+ ret = -1;
+ break;
+ }
- uuid_copy (*peer_uuid, peerinfo->uuid);
- ret = glusterd_op_sm_inject_event (GD_OP_EVENT_LOCAL_UNLOCK_NO_RESP,
- peer_uuid);
- if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Unable"
- " to enque local lock flush event.");
+ uuid_copy (*peer_uuid, peerinfo->uuid);
+ ret = glusterd_op_sm_inject_event
+ (GD_OP_EVENT_LOCAL_UNLOCK_NO_RESP,
+ peer_uuid);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Unable"
+ " to enque local lock flush event.");
+ }
- //Inject friend disconnected here
- if (peerinfo->state.state == GD_FRIEND_STATE_DEFAULT) {
- glusterd_friend_remove_notify (peerinfo,
- peerctx->args.req);
+ //Inject friend disconnected here
+ if (peerinfo->state.state == GD_FRIEND_STATE_DEFAULT) {
+ glusterd_friend_remove_notify (peerinfo,
+ peerctx->args.req);
+ }
}
+ peerinfo->connected = 0;
//default_notify (this, GF_EVENT_CHILD_DOWN, NULL);
break;
}