From 0ebe766bd4211466c4f89b7d48baa0cdaaac08ed Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Wed, 23 May 2012 03:37:16 +0530 Subject: nfs/nlm: when setting nlmclnt->rpc_clnt, do not overwrite old rpc_clnt Change-Id: I01a1c0c0c8d3402b8fe061258001eea2c0029e83 BUG: 819518 Signed-off-by: Krishna Srinivas Reviewed-on: http://review.gluster.com/3419 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/nfs/server/src/nlm4.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'xlators') diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index 98012203b..9a0cd020a 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -337,8 +337,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) { @@ -351,34 +349,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; } -- cgit