summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2015-06-02 15:01:53 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-06-09 07:06:29 -0700
commit4b32816d226b04066b36f569ea34bebfff25d16e (patch)
tree925a667ced1f75f2596aa5efe690c46c8455bd5b /rpc
parent2ff7c89236f1dc2bc0cb9e97ec2ac5a180618ff6 (diff)
rpc: call transport_unref only on non-NULL transport
BUG: 1228601 Change-Id: Ifac4dd8c633081483e4eba9d7e5a89837b2a453a Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/11041 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/11102 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index db99484cb81..2878372df83 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1635,10 +1635,16 @@ rpc_clnt_trigger_destroy (struct rpc_clnt *rpc)
if (!rpc)
return;
+ /* reading conn->trans outside conn->lock is OK, since this is the last
+ * ref*/
conn = &rpc->conn;
trans = conn->trans;
- rpc_clnt_disable (rpc);
- rpc_transport_unref (trans);
+ rpc_clnt_disconnect (rpc);
+
+ /* This is to account for rpc_clnt_disable that might have been called
+ * before rpc_clnt_unref */
+ if (trans)
+ rpc_transport_unref (trans);
}
static void