From d98c3e19342be3b8b3e2c7e3d7e544de34143bdf Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 19 Mar 2012 18:10:34 +0530 Subject: rpc-clnt: separate out connection_cleanup() from destroy() noticed that there are possibilities where one would like to do a connection_cleanup() before destroying a RPC connection itself, also current code is such that, rpc_clnt_connection_cleanup() does rpc_clnt_ref() and unref(), creating a race window/double unref possibilities in the code. by separating out the functions, this race window/double fault can be prevented. Change-Id: I7ebd3392efa891232857b6db9108b0b19e40fc12 Signed-off-by: Amar Tumballi BUG: 802403 Reviewed-on: http://review.gluster.com/2979 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 4b84039df..6bfcd6c00 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -888,6 +888,9 @@ glusterd_friend_cleanup (glusterd_peerinfo_t *peerinfo) glusterd_peerctx_t *peerctx = NULL; if (peerinfo->rpc) { + /* cleanup the saved-frames before last unref */ + rpc_clnt_connection_cleanup (&peerinfo->rpc->conn); + peerctx = peerinfo->rpc->mydata; peerinfo->rpc->mydata = NULL; peerinfo->rpc = rpc_clnt_unref (peerinfo->rpc); @@ -1299,6 +1302,9 @@ glusterd_brick_disconnect (glusterd_brickinfo_t *brickinfo) GF_ASSERT (brickinfo); if (brickinfo->rpc) { + /* cleanup the saved-frames before last unref */ + rpc_clnt_connection_cleanup (&brickinfo->rpc->conn); + rpc_clnt_unref (brickinfo->rpc); brickinfo->rpc = NULL; } -- cgit