diff options
author | Krishna Srinivas <ksriniva@redhat.com> | 2012-04-05 15:57:47 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-04-17 08:26:06 -0700 |
commit | 80eeaab2be884f0ebc89704011421541742cd5e6 (patch) | |
tree | 760c1048e071fbc6bf20f42f1397e180abe5eb8a /xlators/nfs/server/src | |
parent | b69f0110410c670eb6c31b6669d47ec2aaeb92f4 (diff) |
nlm: send sm-notify to clients whenever the nfs server is restarted so that clients reclaim the locks.v3.3.0qa35
Change-Id: I0a8e291ad0a78e2e68070b1d289d32a786da8da2
BUG: 802885
Signed-off-by: Krishna Srinivas <ksriniva@redhat.com>
Reviewed-on: http://review.gluster.com/3096
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/nfs/server/src')
-rw-r--r-- | xlators/nfs/server/src/nlm4.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index b0ab510ef..9fd374b1f 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -43,6 +43,7 @@ #include "rpc-clnt.h" #include "nsm-xdr.h" #include "nlmcbk-xdr.h" +#include "run.h" #include <unistd.h> #include <rpc/pmap_clnt.h> #include <rpc/rpc.h> @@ -1828,6 +1829,25 @@ nlm4svc_init(xlator_t *nfsx) INIT_LIST_HEAD(&nlm_client_list); LOCK_INIT (&nlm_client_list_lk); + /* unlink sm-notify.pid so that when we restart rpc.statd/sm-notify + * it thinks that the machine has restarted and sends NOTIFY to clients. + */ + ret = unlink ("/var/run/sm-notify.pid"); + if (ret == -1 && errno != ENOENT) { + gf_log (GF_NLM, GF_LOG_ERROR, "unable to unlink sm-notify"); + goto err; + } + /* temporary work around to restart statd, not distro/OS independant. + * Need to figure out a more graceful way + */ + ret = runcmd ("killall", "-9", "rpc.statd", NULL); + /* if ret == -1, do nothing - case statd was not already running */ + + ret = runcmd ("rpc.statd", NULL); + if (ret == -1) { + gf_log (GF_NLM, GF_LOG_ERROR, "unable to start rpc.statd"); + goto err; + } pthread_create (&thr, NULL, nsm_thread, (void*)NULL); timeout.tv_sec = nlm_grace_period; |