summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-01-24 20:35:44 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-01-26 23:42:28 -0800
commit11dd59b788334fe2de1653ae85395986ba531606 (patch)
tree72b46794675c3713ea228a1829acaa190b73374e /rpc
parent40cdb88962cff1d32cd46cb089ad8bcd9be3d62d (diff)
rpc: handle proper 'ref', 'unref' of transport from rpc-clnt
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2250 ([glusterfs-3.1.2qa2]: SegFault in rpc-clnt.c) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2250
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c7
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c3
2 files changed, 7 insertions, 3 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index eab7551f0..f25a4b0ad 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1546,8 +1546,11 @@ rpc_clnt_destroy (struct rpc_clnt *rpc)
if (!rpc)
return;
- if (rpc->conn.trans)
- rpc_transport_destroy (rpc->conn.trans);
+ if (rpc->conn.trans) {
+ rpc->conn.trans->mydata = NULL;
+ rpc_transport_unref (rpc->conn.trans);
+ //rpc_transport_destroy (rpc->conn.trans);
+ }
rpc_clnt_connection_cleanup (&rpc->conn);
rpc_clnt_reconnect_cleanup (&rpc->conn);
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index bf0e4dfd6..249c9398f 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -1124,7 +1124,8 @@ rpc_transport_unref (rpc_transport_t *this)
pthread_mutex_unlock (&this->lock);
if (refcount == 0) {
- this->notify (this, this->mydata, RPC_TRANSPORT_CLEANUP, NULL);
+ if (this->mydata)
+ this->notify (this, this->mydata, RPC_TRANSPORT_CLEANUP, NULL);
rpc_transport_destroy (this);
}