From af6769675acbbfd780fa2ece8587502d6d579372 Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Tue, 13 Dec 2016 15:28:42 +0530 Subject: socket: socket disconnect should wait for poller thread exit When SSL is enabled or if "transport.socket.own-thread" option is set then socket_poller is run as different thread. Currently during disconnect or PARENT_DOWN scenario we don't wait for this thread to terminate. PARENT_DOWN will disconnect the socket layer and cleanup resources used by socket_poller. Therefore before disconnect we should wait for poller thread to exit. Change-Id: I71f984b47d260ffd979102f180a99a0bed29f0d6 BUG: 1404181 Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/16141 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kaushal M Reviewed-by: Raghavendra Talur Reviewed-by: Raghavendra G --- rpc/rpc-transport/rdma/src/rdma.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'rpc/rpc-transport/rdma/src') diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 551ac072079..d2f04bd6d0c 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -51,7 +51,7 @@ static int32_t gf_rdma_teardown (rpc_transport_t *this); static int32_t -gf_rdma_disconnect (rpc_transport_t *this); +gf_rdma_disconnect (rpc_transport_t *this, gf_boolean_t wait); static void gf_rdma_cm_handle_disconnect (rpc_transport_t *this); @@ -1209,7 +1209,7 @@ gf_rdma_cm_handle_connect_init (struct rdma_cm_event *event) } if (ret < 0) { - gf_rdma_disconnect (this); + gf_rdma_disconnect (this, _gf_false); } return ret; @@ -3014,7 +3014,7 @@ gf_rdma_submit_request (rpc_transport_t *this, rpc_transport_req_t *req) RDMA_MSG_WRITE_PEER_FAILED, "sending request to peer (%s) failed", this->peerinfo.identifier); - rpc_transport_disconnect (this); + rpc_transport_disconnect (this, _gf_false); } out: @@ -3051,7 +3051,7 @@ gf_rdma_submit_reply (rpc_transport_t *this, rpc_transport_reply_t *reply) RDMA_MSG_WRITE_PEER_FAILED, "sending request to peer (%s) failed", this->peerinfo.identifier); - rpc_transport_disconnect (this); + rpc_transport_disconnect (this, _gf_false); } out: @@ -4095,7 +4095,7 @@ gf_rdma_process_recv (gf_rdma_peer_t *peer, struct ibv_wc *wc) out: if (ret == -1) { - rpc_transport_disconnect (peer->trans); + rpc_transport_disconnect (peer->trans, _gf_false); } return; @@ -4216,7 +4216,8 @@ gf_rdma_recv_completion_proc (void *data) if (peer) { ibv_ack_cq_events (event_cq, num_wr); rpc_transport_unref (peer->trans); - rpc_transport_disconnect (peer->trans); + rpc_transport_disconnect (peer->trans, + _gf_false); } if (post) { @@ -4292,7 +4293,7 @@ gf_rdma_handle_failed_send_completion (gf_rdma_peer_t *peer, struct ibv_wc *wc) } if (peer) { - rpc_transport_disconnect (peer->trans); + rpc_transport_disconnect (peer->trans, _gf_false); } return; @@ -4343,7 +4344,7 @@ gf_rdma_handle_successful_send_completion (gf_rdma_peer_t *peer, ret = gf_rdma_pollin_notify (peer, post); if ((ret == -1) && (peer != NULL)) { - rpc_transport_disconnect (peer->trans); + rpc_transport_disconnect (peer->trans, _gf_false); } out: @@ -4657,7 +4658,7 @@ gf_rdma_init (rpc_transport_t *this) static int32_t -gf_rdma_disconnect (rpc_transport_t *this) +gf_rdma_disconnect (rpc_transport_t *this, gf_boolean_t wait) { gf_rdma_private_t *priv = NULL; int32_t ret = 0; -- cgit