diff options
| author | Krishna Srinivas <ksriniva@redhat.com> | 2012-05-23 03:37:16 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-06-01 15:12:58 -0700 | 
| commit | 0ebe766bd4211466c4f89b7d48baa0cdaaac08ed (patch) | |
| tree | 5919e4bb9f79e991195d84909340ec51cc59e77d | |
| parent | 8efd28456db7fa68aabc355a8fc217430b5bf97a (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/3419
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
| -rw-r--r-- | xlators/nfs/server/src/nlm4.c | 23 | 
1 files changed, 5 insertions, 18 deletions
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;  }  | 
