summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2016-02-16 18:50:23 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-24 08:02:18 -0700
commit10d7b9d45a90d345f6ce4ec0e7192e0226602d80 (patch)
treefdef28d1eac925da3501b95c5256428857585c24 /rpc/rpc-lib/src
parent75046f96c40679da8dae20a3a0b2f6a2b4c34517 (diff)
rpc: Fix for rpc_transport_t leak
The transport object needs to get unref'ed when the rpc clnt object is getting destroyed. But currently in rpc_clnt_disable() we set conn->trans to NULL before it gets unref'ed leading to transport object leak. This change is to fix it by setting conn-tran to NULL only when it is being unref'ed. This is backport of the below patch - http://review.gluster.org/13456 Change-Id: I79ba34e28ae19eb616035f36bbed1c2f47875b94 BUG: 1311441 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/13456 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/13507 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 28c6c8b4818..43ebd152c29 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1678,8 +1678,10 @@ rpc_clnt_trigger_destroy (struct rpc_clnt *rpc)
/* This is to account for rpc_clnt_disable that might have been called
* before rpc_clnt_unref */
- if (trans)
+ if (trans) {
rpc_transport_unref (trans);
+ conn->trans = NULL;
+ }
}
static void
@@ -1774,7 +1776,6 @@ rpc_clnt_disable (struct rpc_clnt *rpc)
unref = rpc_clnt_remove_ping_timer_locked (rpc);
trans = conn->trans;
- conn->trans = NULL;
}
pthread_mutex_unlock (&conn->lock);