You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

167 lines
3.6 KiB

diff --git a/nfs.conf b/nfs.conf
new file mode 100644
index 0000000..690645c
--- /dev/null
+++ b/nfs.conf
@@ -0,0 +1,71 @@
+#
+# This is a general conifguration for the
+# NFS daemons and tools
+#
+#[exportfs]
+# debug=0
+#
+#[gssd]
+# use-memcache=0
+# use-machine-creds=1
+# avoid-dns=1
+# limit-to-legacy-enctypes=0
+# context-timeout=0
+# rpc-timeout=5
+# pipefs-directory=/var/lib/nfs/rpc_pipefs
+# keytab-file=/etc/krb5.keytab
+# cred-cache-directory=
+# preferred-realm=
+#
+#[lockd]
+# port=0
+# udp-port=0
+#
+#[mountd]
+# debug=0
+# manage_gids=n
+# descriptors=0
+# port=0
+# threads=1
+# reverse-lookup=n
+# state-directory-path=/var/lib/nfs
+# ha-callout=
+#
+#[nfsdcltrack]
+# debug=0
+# storagedir=/var/lib/nfs/nfsdcltrack
+#
+#[nfsd]
+# debug=0
+# threads=8
+# host=
+# port=0
+# grace-time=90
+# lease-time=90
+# udp=y
+# tcp=y
+# vers2=n
+# vers3=y
+# vers4=y
+# vers4.0=y
+# vers4.1=y
+# vers4.2=y
+# rdma=n
+#
+#[statd]
+# debug=0
+# port=0
+# outgoing-port=0
+# name=
+# state-directory-path=/var/lib/nfs/statd
+# ha-callout=
+#
+#[sm-notify]
+# debug=0
+# retry-time=900
+# outgoing-port=
+# outgoing-addr=
+# lift-grace=y
+#
+#[svcgssd]
+# principal=
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index dcb85a3..ec59311 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -46,6 +46,10 @@
#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"
+
+int lift_grace = 1;
+
struct nsm_host {
struct nsm_host * next;
char * name;
@@ -456,6 +460,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)
{
@@ -474,6 +500,7 @@ main(int argc, char **argv)
opt_max_retry = conf_get_num("sm-notify", "retry-time", opt_max_retry / 60) * 60;
opt_srcport = conf_get_str("sm-notify", "outgoing-port");
opt_srcaddr = conf_get_str("sm-notify", "outgoing-addr");
+ lift_grace = conf_get_bool("sm-notify", "lift-grace", lift_grace);
s = conf_get_str("statd", "state-directory-path");
if (s && !nsm_setup_pathnames(argv[0], s))
exit(1);
@@ -550,6 +577,8 @@ 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");
+ if (lift_grace)
+ nsm_lift_grace_period();
return 0;
}
diff --git a/utils/statd/sm-notify.man b/utils/statd/sm-notify.man
index 89627e5..4658d86 100644
--- a/utils/statd/sm-notify.man
+++ b/utils/statd/sm-notify.man
@@ -241,6 +241,24 @@ These have the same effect as the command line options
.B v
respectively.
+An additional value recognized in the
+.B [sm-notify]
+section is
+.BR lift-grace .
+By default,
+.B sm-notify
+will lift lockd's grace period early if it has no hosts to notify.
+Some high availability configurations will run one
+.B sm-notify
+per floating IP address. In these configurations, lifting the
+grace period early may prevent clients from reclaiming locks.
+.RB "Setting " lift-grace " to " n
+will prevent
+.B sm-notify
+from ending the grace period early.
+.B lift-grace
+has no corresponding command line option.
+
The value recognized in the
.B [statd]
section is