summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrishna Srinivas <ksriniva@redhat.com>2012-05-23 03:37:16 +0530
committerVijay Bellur <vijay@gluster.com>2012-07-03 04:51:36 -0700
commit8519baae01b64c3d102b2af6e6e8912f17907fb2 (patch)
tree1544fe5b0e1d843800d4b880d47b3200456207b3 /xlators
parenta0cf60dc59642b4b4db24173fb9ab1bb81c10a89 (diff)
nfs/nlm: when setting nlmclnt->rpc_clnt, do not overwrite old rpc_clnt
Change-Id: I01a1c0c0c8d3402b8fe061258001eea2c0029e83 BUG: 819518 Signed-off-by: Krishna Srinivas <ksriniva@redhat.com> Reviewed-on: http://review.gluster.com/3433 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/nfs/server/src/nlm4.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index d6c5ce04e8b..08aaef0be07 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -336,8 +336,6 @@ nlm_set_rpc_clnt (rpc_clnt_t *rpc_clnt, char *caller_name)
nlm_client_t *nlmclnt = NULL;
int nlmclnt_found = 0;
int ret = -1;
- rpc_clnt_t *rpc_clnt_old = NULL;
- char *old_name = NULL;
LOCK (&nlm_client_list_lk);
list_for_each_entry (nlmclnt, &nlm_client_list, nlm_clients) {
@@ -350,34 +348,23 @@ nlm_set_rpc_clnt (rpc_clnt_t *rpc_clnt, char *caller_name)
nlmclnt = GF_CALLOC (1, sizeof(*nlmclnt),
gf_nfs_mt_nlm4_nlmclnt);
if (nlmclnt == NULL) {
- gf_log (GF_NLM, GF_LOG_DEBUG, "malloc error");
+ gf_log (GF_NLM, GF_LOG_ERROR, "mem-alloc error");
goto ret;
}
INIT_LIST_HEAD(&nlmclnt->fdes);
INIT_LIST_HEAD(&nlmclnt->nlm_clients);
+ INIT_LIST_HEAD(&nlmclnt->shares);
list_add (&nlmclnt->nlm_clients, &nlm_client_list);
+ nlmclnt->caller_name = gf_strdup (caller_name);
}
- rpc_clnt_old = nlmclnt->rpc_clnt;
- old_name = nlmclnt->caller_name;
- if (rpc_clnt)
+ if (nlmclnt->rpc_clnt == NULL) {
nlmclnt->rpc_clnt = rpc_clnt_ref (rpc_clnt);
- nlmclnt->caller_name = gf_strdup (caller_name);
-
+ }
ret = 0;
ret:
UNLOCK (&nlm_client_list_lk);
-
- 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;
}