From 4b32816d226b04066b36f569ea34bebfff25d16e Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 2 Jun 2015 15:01:53 +0530 Subject: rpc: call transport_unref only on non-NULL transport BUG: 1228601 Change-Id: Ifac4dd8c633081483e4eba9d7e5a89837b2a453a Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/11041 Reviewed-by: Raghavendra G Reviewed-on: http://review.gluster.org/11102 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- rpc/rpc-lib/src/rpc-clnt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rpc/rpc-lib') 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 -- cgit