Red Hat Bugzilla – Bug 1063088
nfs init script does not take into account that nfsd modifies the grace time
Last modified: 2017-03-17 07:37:19 EDT
nfsd modifies the grace time for nfsv4 in magic ways: https://bugzilla.redhat.com/show_bug.cgi?id=1063087 As a result of this the NFSD_V4_GRACE variable in /etc/sysconfig/nfs does not work as expected. Since nfsd enforces that the grace time is always >= the lease time the lease time also needs to be changed together with the grace time in the init script. Since this does not happen at the moment the expected grace time will only be set for a few seconds after the nfs service is started and then reset by nfsd to the value of /proc/fs/nfsd/nfsv4leasetime. So the following code from the init script: # Set v4 grace period if requested [ -n "$NFSD_V4_GRACE" ] && { echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4gracetime } needs to be changed to this: # Set v4 grace period if requested [ -n "$NFSD_V4_GRACE" ] && { echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4leasetime echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4gracetime } This is the easiest fix. A more correct one would probably remove the NFSD_V4_GRACE variable entirely and replace it with a NFSD_V4_LEASE variable and then derive the grace time from that (e.g. grace time = lease time + padding) sind the grace time should always be at least the same as the lease time but probably a bit larger (which is what nfsd now apparently enforces).
(In reply to Dennis Jacobfeuerborn from comment #0) > nfsd modifies the grace time for nfsv4 in magic ways: > https://bugzilla.redhat.com/show_bug.cgi?id=1063087 > > As a result of this the NFSD_V4_GRACE variable in /etc/sysconfig/nfs does > not work as expected. > Since nfsd enforces that the grace time is always >= the lease time the > lease time also needs to be changed together with the grace time in the init > script. Since this does not happen at the moment the expected grace time > will only be set for a few seconds after the nfs service is started and then > reset by nfsd to the value of /proc/fs/nfsd/nfsv4leasetime. > > So the following code from the init script: > > # Set v4 grace period if requested > [ -n "$NFSD_V4_GRACE" ] && { > echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4gracetime > } > > needs to be changed to this: > > # Set v4 grace period if requested > [ -n "$NFSD_V4_GRACE" ] && { > echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4leasetime > echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4gracetime > } > Why not just set NFSD_V4_LEASE to the same value of NFSD_V4_GRACE?
NFSD_V4_LEASE doesn't seem to exists: [root@nfs1a ~]# grep LEASE /etc/sysconfig/nfs [root@nfs1a ~]# grep LEASE /etc/init.d/nfs [root@nfs1a ~]#
(In reply to Dennis Jacobfeuerborn from comment #4) > NFSD_V4_LEASE doesn't seem to exists: > > [root@nfs1a ~]# grep LEASE /etc/sysconfig/nfs > [root@nfs1a ~]# grep LEASE /etc/init.d/nfs > [root@nfs1a ~]# It was added to the nfs-utils-1.2.3-48.el6 version: rhel6$ grep LEASE /etc/sysconfig/nfs # NFSD_V4_LEASE was on the previous boot. # first make NFSD_V4_LEASE shorter, then restart server. #NFSD_V4_LEASE=90 rhel6$ grep LEASE /etc/init.d/nfs [ -n "$NFSD_V4_LEASE" ] && { echo "$NFSD_V4_LEASE" > /proc/fs/nfsd/nfsv4leasetime rhel6$ see bug 1058354 *** This bug has been marked as a duplicate of bug 1058354 ***