summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-03-08 11:20:19 -0500
committerSteve Dickson <steved@redhat.com>2014-03-11 12:03:05 -0400
commit0f62f94ac6304c5c030ae9eecf5a933c1c2b543a (patch)
treed00e0a9c0026e0ec21dd0a1c67f756d9d19dc9d7
parent85f688bf3951d6ece278045acb344f747d388830 (diff)
downloadnfs-utils-0f62f94ac6304c5c030ae9eecf5a933c1c2b543a.tar.gz
nfs-utils-0f62f94ac6304c5c030ae9eecf5a933c1c2b543a.tar.xz
nfs-utils-0f62f94ac6304c5c030ae9eecf5a933c1c2b543a.zip
nfsd: set nlm grace time to make NFSv4 grace time
These two values are conceptually very similar, so it probably makes sense to set them to the same value at the same time. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/nfsd/nfsd.man3
-rw-r--r--utils/nfsd/nfssvc.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index 58b53cb..c6d3ffb 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -89,7 +89,8 @@ clients need to confirm their state with the server. Valid range is
from 10 to 3600 seconds.
.TP
.B \-G " or " \-\-grace-time seconds
-Set the grace-time used for NFSv4. New file open requests will not be
+Set the grace-time used for NFSv4 and NLM (for NFSv2 and NFSv3).
+New file open requests (NFSv4) and new file locks (NLM) will not be
allowed until after this time has passed to allow clients to recover state.
.TP
.I nproc
diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index eb21685..0675b6a 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -317,6 +317,14 @@ nfssvc_set_time(const char *type, const int seconds)
xlog(L_ERROR, "Unable to set nfsv4%stime: %m", type);
close(fd);
}
+ if (strcmp(type, "grace") == 0) {
+ /* set same value for lockd */
+ fd = open("/proc/sys/fs/nfs/nlm_grace_period", O_WRONLY);
+ if (fd >= 0) {
+ write(fd, nbuf, strlen(nbuf));
+ close(fd);
+ }
+ }
}
void