From 80eeaab2be884f0ebc89704011421541742cd5e6 Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Thu, 5 Apr 2012 15:57:47 +0530 Subject: nlm: send sm-notify to clients whenever the nfs server is restarted so that clients reclaim the locks. Change-Id: I0a8e291ad0a78e2e68070b1d289d32a786da8da2 BUG: 802885 Signed-off-by: Krishna Srinivas Reviewed-on: http://review.gluster.com/3096 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/nfs/server/src/nlm4.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 #include #include @@ -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; -- cgit