From 43800dedb5f0b4644de913c3fd50c6b409ec7210 Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Thu, 18 Sep 2014 04:21:04 -0400 Subject: rdma:rdma fuse mount hangs for tcp,rdma volumes if brick is down. When we try to mount a tcp,rdma volume as rdma transport using FUSE protocol, then mount will hang if the brick is down. When we kill a process, signal will be received in glusterfsd process and it will call pmap_signout with port listening on tcp only. In case of the tcp,rdma there will be two ports, and port which is listening for rdma will not called for sign out. So the mount process will try to connect to a port which is not open and it will keep trying to connect. This patch will call pmap_signout for rdma port also, So when mount tries to get the brick port,it will fail. Change-Id: I23676f65f96eb90b69b76478f7a21412a6aba70f BUG: 1143886 Signed-off-by: Mohammed Rafi KC Reviewed-on: http://review.gluster.org/8762 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- glusterfsd/src/glusterfsd-mgmt.c | 2 +- rpc/rpc-transport/rdma/src/rdma.c | 7 ++----- rpc/xdr/src/portmap-xdr.x | 1 + xlators/mgmt/glusterd/src/glusterd-pmap.c | 20 ++++++++++++++------ xlators/protocol/client/src/client-handshake.c | 1 - 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index e72483509be..9addd77cb26 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -2238,7 +2238,7 @@ glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx) req.port = cmd_args->brick_port; req.brick = cmd_args->brick_name; - + req.rdma_port = cmd_args->brick_port2; ret = mgmt_submit_request (&req, frame, ctx, &clnt_pmap_prog, GF_PMAP_SIGNOUT, mgmt_pmap_signout_cbk, (xdrproc_t)xdr_pmap_signout_req); diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 3ceb197f2a3..89ed4558d72 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -938,7 +938,7 @@ static void gf_rdma_cm_handle_disconnect (rpc_transport_t *this) { gf_rdma_private_t *priv = NULL; - char need_unref = 0, connected = 0; + char need_unref = 0; priv = this->private; gf_log (this->name, GF_LOG_DEBUG, @@ -948,7 +948,6 @@ gf_rdma_cm_handle_disconnect (rpc_transport_t *this) { if (priv->peer.cm_id != NULL) { need_unref = 1; - connected = priv->connected; priv->connected = 0; } @@ -956,9 +955,7 @@ gf_rdma_cm_handle_disconnect (rpc_transport_t *this) } pthread_mutex_unlock (&priv->write_mutex); - if (connected) { - rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this); - } + rpc_transport_notify (this, RPC_TRANSPORT_DISCONNECT, this); if (need_unref) rpc_transport_unref (this); diff --git a/rpc/xdr/src/portmap-xdr.x b/rpc/xdr/src/portmap-xdr.x index f60dcc76c8e..7380de5e9ca 100644 --- a/rpc/xdr/src/portmap-xdr.x +++ b/rpc/xdr/src/portmap-xdr.x @@ -47,6 +47,7 @@ struct pmap_signin_rsp { struct pmap_signout_req { string brick<>; int port; + int rdma_port; }; struct pmap_signout_rsp { diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index a54a87b1d33..e4dacb80c4a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -438,9 +438,10 @@ gluster_pmap_signin (rpcsvc_request_t *req) int __gluster_pmap_signout (rpcsvc_request_t *req) { - pmap_signout_req args = {0,}; - pmap_signout_rsp rsp = {0,}; - int ret = -1; + pmap_signout_req args = {0,}; + pmap_signout_rsp rsp = {0,}; + int ret = -1; + char brick_path[PATH_MAX] = {0,}; glusterd_brickinfo_t *brickinfo = NULL; ret = xdr_to_generic (req->msg[0], &args, @@ -456,14 +457,21 @@ __gluster_pmap_signout (rpcsvc_request_t *req) ret = glusterd_get_brickinfo (THIS, args.brick, args.port, _gf_true, &brickinfo); + if (args.rdma_port) { + snprintf(brick_path, PATH_MAX, "%s.rdma", args.brick); + rsp.op_ret = pmap_registry_remove (THIS, args.rdma_port, + brick_path, GF_PMAP_PORT_BRICKSERVER, + req->trans); + } + + if (!ret) + glusterd_brick_update_signin (brickinfo, _gf_false); + fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_pmap_signout_rsp); free (args.brick);//malloced by xdr - if (!ret) - glusterd_brick_update_signin (brickinfo, _gf_false); - return 0; } diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index cf91c3b723c..8bd3d6a3d09 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -1502,7 +1502,6 @@ client_query_portmap_cbk (struct rpc_req *req, struct iovec *iov, int count, voi conf->portmap_err_logged = 0; conf->disconnect_err_logged = 0; - config.remote_port = rsp.port; rpc_clnt_reconfig (conf->rpc, &config); -- cgit