summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-02-29 16:16:12 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-29 08:15:20 -0800
commit0054807e5288727599bc264e64f83e9fb526732f (patch)
tree258111d35eedada7e8a92feb489e8402b7e116b6 /xlators/nfs
parent72eda6a45b52e98458e4efa3e9819a8a3a25faef (diff)
nfs: prevent crash during cthon lock test
When cthon was invoked to test nlm, the mount point would hang, and crash nfs server, and all the brick processes. This path fixes the crashes. Change-Id: Ide88adb7e25ea722b143bfd62e23361ff7be4b67 BUG: 798194 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2842 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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index 5145dc965..3a13cb167 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -438,8 +438,8 @@ int nsm_monitor(char *host)
struct timeval tout = { 5, 0 };
int retstat = -1;
- nsm_mon.mon_id.mon_name = strdup(host);
- nsm_mon.mon_id.my_id.my_name = strdup("localhost");
+ nsm_mon.mon_id.mon_name = gf_strdup(host);
+ nsm_mon.mon_id.my_id.my_name = gf_strdup("localhost");
nsm_mon.mon_id.my_id.my_prog = NLMCBK_PROGRAM;
nsm_mon.mon_id.my_id.my_vers = NLMCBK_V1;
nsm_mon.mon_id.my_id.my_proc = NLMCBK_SM_NOTIFY;
@@ -473,8 +473,8 @@ int nsm_monitor(char *host)
}
retstat = 0;
out:
- free(nsm_mon.mon_id.mon_name);
- free(nsm_mon.mon_id.my_id.my_name);
+ GF_FREE(nsm_mon.mon_id.mon_name);
+ GF_FREE(nsm_mon.mon_id.my_id.my_name);
clnt_destroy(clnt);
return retstat;
}
@@ -831,6 +831,7 @@ nlm4_establish_callback (void *csarg)
char *caller_name = NULL;
cs = (nfs3_call_state_t *) csarg;
+ glusterfs_this_set (cs->nfsx);
caller_name = cs->args.nlm4_lockargs.alock.caller_name;
nsm_monitor (caller_name);
@@ -847,6 +848,7 @@ nlm4_establish_callback (void *csarg)
inet_ntop (AF_INET,
&((struct sockaddr_in *)sockaddr)->sin_addr,
peerip, INET6_ADDRSTRLEN+1);
+ break;
default:
break;
/* FIXME: handle the error */
@@ -863,7 +865,7 @@ nlm4_establish_callback (void *csarg)
goto err;
}
- ret = dict_set_dynstr (options, "remote-host", strdup (peerip));
+ ret = dict_set_dynstr (options, "remote-host", gf_strdup (peerip));
if (ret == -1) {
gf_log (GF_NLM, GF_LOG_ERROR, "dict_set_str error");
goto err;