summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-08-25 17:51:18 +0530
committerAnand Avati <avati@gluster.com>2011-09-07 10:49:33 -0700
commit34be428d5640a0ad4c47a05ee3e716189b4a54ed (patch)
tree4d8bfcbef46af1c5b788441a3ad5d36306aaa525 /xlators/mgmt/glusterd
parentf0f3b040dfa062021d3a193e5a19c380eb5e908d (diff)
glusterd: fail the 'peer probe' if the first connect attempt fails
so 'gluster peer probe' command doesn't hang till timeout (120s), instead it will send the proper error msg to client. Change-Id: I398fa16d526f869f1d27eeb57aeb7ee4451fbecd BUG: 1852 Reviewed-on: http://review.gluster.com/342 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c52
1 files changed, 48 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 881e84214..0547694ca 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2415,6 +2415,40 @@ glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
}
int
+glusterd_friend_remove_notify (glusterd_peerinfo_t *peerinfo, rpcsvc_request_t *req)
+{
+ int ret = -1;
+ glusterd_friend_sm_event_t *new_event = NULL;
+
+ ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_REMOVE_FRIEND,
+ &new_event);
+ if (!ret) {
+ new_event->peerinfo = peerinfo;
+ ret = glusterd_friend_sm_inject_event (new_event);
+
+ glusterd_friend_sm ();
+ glusterd_op_sm ();
+
+ if (!req) {
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "Unable to find the request for responding "
+ "to User (%s)", peerinfo->hostname);
+ goto out;
+ }
+
+ glusterd_xfer_cli_probe_resp (req, -1, ENOTCONN,
+ peerinfo->hostname, peerinfo->port);
+ } else {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "Unable to create event for removing peer %s",
+ peerinfo->hostname);
+ }
+
+out:
+ return ret;
+}
+
+int
glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
rpc_clnt_event_t event,
void *data)
@@ -2448,10 +2482,10 @@ glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
}
case RPC_CLNT_DISCONNECT:
+ {
+ gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_DISCONNECT %d",
+ peerinfo->state.state);
- //Inject friend disconnected here
-
- gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_DISCONNECT");
peerinfo->connected = 0;
/*
@@ -2482,9 +2516,19 @@ glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
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) {
+ /* Remove the friend as it was the newly requested
+ 'peer' and connection with this peer didn't
+ succeed. we have opportunity to notify user
+ */
+ glusterd_friend_remove_notify (peerinfo,
+ peerctx->args.req);
+ }
+
//default_notify (this, GF_EVENT_CHILD_DOWN, NULL);
break;
-
+ }
default:
gf_log (this->name, GF_LOG_TRACE,
"got some other RPC event %d", event);