diff options
author | Rajesh Joseph <rjoseph@redhat.com> | 2016-12-13 15:28:42 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2016-12-21 20:49:19 -0800 |
commit | af6769675acbbfd780fa2ece8587502d6d579372 (patch) | |
tree | e464f44c08163b9ba84e3d91d1e9d71efd5c04dc /rpc/rpc-lib/src | |
parent | 8b42e1b5688f8600086ecc0e33ac4abf5e7c2772 (diff) |
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 <rjoseph@redhat.com>
Reviewed-on: http://review.gluster.org/16141
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt-ping.c | 2 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 4 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 5 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 4 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 2 |
5 files changed, 9 insertions, 8 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt-ping.c b/rpc/rpc-lib/src/rpc-clnt-ping.c index 3eb7e90cb01..e042121ad47 100644 --- a/rpc/rpc-lib/src/rpc-clnt-ping.c +++ b/rpc/rpc-lib/src/rpc-clnt-ping.c @@ -159,7 +159,7 @@ rpc_clnt_ping_timer_expired (void *rpc_ptr) trans->peerinfo.identifier, conn->ping_timeout); - rpc_transport_disconnect (conn->trans); + rpc_transport_disconnect (conn->trans, _gf_false); } out: diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index b868f56bdb3..d39b5236b91 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1854,7 +1854,7 @@ rpc_clnt_disable (struct rpc_clnt *rpc) pthread_mutex_unlock (&conn->lock); if (trans) { - rpc_transport_disconnect (trans); + rpc_transport_disconnect (trans, _gf_true); } if (unref) @@ -1913,7 +1913,7 @@ rpc_clnt_disconnect (struct rpc_clnt *rpc) pthread_mutex_unlock (&conn->lock); if (trans) { - rpc_transport_disconnect (trans); + rpc_transport_disconnect (trans, _gf_true); } if (unref) rpc_clnt_unref (rpc); diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 6ee5e15ede4..33e94450d9c 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -435,13 +435,14 @@ fail: int32_t -rpc_transport_disconnect (rpc_transport_t *this) +rpc_transport_disconnect (rpc_transport_t *this, gf_boolean_t wait) { int32_t ret = -1; GF_VALIDATE_OR_GOTO("rpc_transport", this, fail); - ret = this->ops->disconnect (this); + ret = this->ops->disconnect (this, wait); + fail: return ret; } diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index 4e7a8c46fae..717c40af13a 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -224,7 +224,7 @@ struct rpc_transport_ops { rpc_transport_reply_t *reply); int32_t (*connect) (rpc_transport_t *this, int port); int32_t (*listen) (rpc_transport_t *this); - int32_t (*disconnect) (rpc_transport_t *this); + int32_t (*disconnect) (rpc_transport_t *this, gf_boolean_t wait); int32_t (*get_peername) (rpc_transport_t *this, char *hostname, int hostlen); int32_t (*get_peeraddr) (rpc_transport_t *this, char *peeraddr, @@ -248,7 +248,7 @@ int32_t rpc_transport_connect (rpc_transport_t *this, int port); int32_t -rpc_transport_disconnect (rpc_transport_t *this); +rpc_transport_disconnect (rpc_transport_t *this, gf_boolean_t wait); int32_t rpc_transport_destroy (rpc_transport_t *this); diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index c792909cb87..52b57205f6d 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -1654,7 +1654,7 @@ rpcsvc_create_listener (rpcsvc_t *svc, dict_t *options, char *name) ret = 0; out: if (!listener && trans) { - rpc_transport_disconnect (trans); + rpc_transport_disconnect (trans, _gf_true); } return ret; |