summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils/statd/sm-notify.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index 5994b2f..8afddd9 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -42,6 +42,8 @@
#define NSM_TIMEOUT 2
#define NSM_MAX_TIMEOUT 120 /* don't make this too big */
+#define NLM_END_GRACE_FILE "/proc/fs/lockd/nlm_end_grace"
+
struct nsm_host {
struct nsm_host * next;
char * name;
@@ -450,6 +452,28 @@ retry:
return sock;
}
+/* Inform the kernel that it's OK to lift lockd's grace period */
+static void
+nsm_lift_grace_period(void)
+{
+ int fd;
+
+ fd = open(NLM_END_GRACE_FILE, O_WRONLY);
+ if (fd < 0) {
+ /* Don't warn if file isn't present */
+ if (errno != ENOENT)
+ xlog(L_WARNING, "Unable to open %s: %m",
+ NLM_END_GRACE_FILE);
+ return;
+ }
+
+ if (write(fd, "Y", 1) < 0)
+ xlog(L_WARNING, "Unable to write to %s: %m", NLM_END_GRACE_FILE);
+
+ close(fd);
+ return;
+}
+
int
main(int argc, char **argv)
{
@@ -534,6 +558,7 @@ usage: fprintf(stderr,
(void)nsm_retire_monitored_hosts();
if (nsm_load_notify_list(smn_get_host) == 0) {
xlog(D_GENERAL, "No hosts to notify; exiting");
+ nsm_lift_grace_period();
return 0;
}