summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2017-01-05 23:58:21 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-02-06 06:13:46 -0500
commitb3188c61d248526a070b1b18df1ea1d181b349d6 (patch)
tree47471fadb274430f9c7bfc0b848e26ac5bd5e459 /rpc
parentddf05f3d1e39cc920251c809e9ba42fe42b2c5f2 (diff)
socket: GF_REF_PUT should be called outside lock
GF_REF_PUT was called inside lock which can call socket_poller_mayday which inturn tries to take the same lock. This can lead to deadlock scenario. BUG: 1410701 Change-Id: Ib3b161bcfeac810bd3593dc04c10ef984f996b17 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: https://review.gluster.org/16343 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 9905712..09020aa 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -2427,7 +2427,6 @@ socket_poller (void *ctx)
* conditionally
*/
THIS = this->xl;
- GF_REF_GET (priv);
if (priv->ot_state == OT_PLEASE_DIE) {
gf_log (this->name, GF_LOG_DEBUG, "socket_poller is exiting "
@@ -2620,6 +2619,8 @@ socket_spawn (rpc_transport_t *this)
gf_log (this->name, GF_LOG_TRACE,
"spawning %p with gen %u", this, priv->ot_gen);
+ GF_REF_GET (priv);
+
/* Create thread after enable detach flag */
ret = gf_thread_create_detached (&priv->thread, socket_poller, this);
@@ -2877,9 +2878,10 @@ socket_disconnect (rpc_transport_t *this, gf_boolean_t wait)
priv = this->private;
if (wait && priv->own_thread) {
+ GF_REF_PUT (priv);
+
pthread_mutex_lock (&priv->cond_lock);
{
- GF_REF_PUT (priv);
/* Change the state to OT_PLEASE_DIE so that
* socket_poller can exit. */
priv->ot_state = OT_PLEASE_DIE;