summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-03-19 18:10:34 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-19 09:14:40 -0700
commitd98c3e19342be3b8b3e2c7e3d7e544de34143bdf (patch)
treeba1d1d18d33694c99749dd005d0d46e91020e7e1 /xlators/nfs
parent55c22fbfae259bff3b0e0cca192f709b74d8bee5 (diff)
rpc-clnt: separate out connection_cleanup() from destroy()v3.3.0qa30
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 <amarts@redhat.com> BUG: 802403 Reviewed-on: http://review.gluster.com/2979 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/nfs')
-rw-r--r--xlators/nfs/server/src/nlm4.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index 0a0d2636649..16507d069d3 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -315,8 +315,14 @@ nlm_set_rpc_clnt (rpc_clnt_t *rpc_clnt, char *caller_name)
ret = 0;
ret:
UNLOCK (&nlm_client_list_lk);
- if (rpc_clnt_old)
+
+ if (rpc_clnt_old) {
+ /* cleanup the saved-frames before last unref */
+ rpc_clnt_connection_cleanup (&rpc_clnt_old->conn);
+
rpc_clnt_unref (rpc_clnt_old);
+ }
+
if (old_name)
GF_FREE (old_name);
return ret;
@@ -340,8 +346,12 @@ nlm_unset_rpc_clnt (rpc_clnt_t *rpc)
if (rpc_clnt == NULL) {
return -1;
}
- if (rpc_clnt)
+ if (rpc_clnt) {
+ /* cleanup the saved-frames before last unref */
+ rpc_clnt_connection_cleanup (&rpc_clnt->conn);
+
rpc_clnt_unref (rpc_clnt);
+ }
return 0;
}