From 22dadd82ee316a278e7804b5d958f72a2ce80309 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 7 Feb 2019 10:38:26 +0100 Subject: [PATCH 1/2] Add nfsd.service The file nfsd.service is currenty untracked. Import it into mxtools. This is preferred to the option of including it in the nfs_tools bee package, because it contains local configuration (e.g. the number 64 for the nproc argument) and we don't want to rebuild the bee package because of small configuration changes. Also add file to install script. --- install.sh | 1 + misc_systemd_units/nfsd.service | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 misc_systemd_units/nfsd.service diff --git a/install.sh b/install.sh index 95dc3ef..98d360d 100755 --- a/install.sh +++ b/install.sh @@ -135,4 +135,5 @@ install_exec fon/fon.sh "$DESTDIR$usr_bindir/fo install_exec nfsdtop/nfsdtop "$DESTDIR$usr_sbindir/nfsdtop" install_data serial-log/serial-log\@.service "$DESTDIR$systemdunitdir/serial-log@.service" install_exec serial-log/serial-log "$DESTDIR$usr_exec_prefix/libexec/serial-log" +install_data misc_systemd_units/nfsd.service "$DESTDIR$systemdunitdir/nfsd.service" exit diff --git a/misc_systemd_units/nfsd.service b/misc_systemd_units/nfsd.service new file mode 100644 index 0000000..77e67aa --- /dev/null +++ b/misc_systemd_units/nfsd.service @@ -0,0 +1,17 @@ +[Unit] +Description=NFS Daemon +ConditionPathExists=/etc/exports +Requires=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount unbound.service +After=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount unbound.service + +[Service] +ExecStartPre=/bin/mkdir -p /var/lib/nfs/v4recovery +ExecStartPre=/usr/sbin/exportfs -ra +ExecStart=/usr/sbin/rpc.mountd --foreground --manage-gids +ExecStartPost=/usr/sbin/rpc.nfsd -N 3 64 ; /usr/sbin/sm-notify +ExecReload=/usr/sbin/exportfs -ra +ExecStopPost=/usr/sbin/rpc.nfsd 0 ; /usr/sbin/exportfs -ua +Restart=always + +[Install] +WantedBy=multi-user.target From ce3a77f55f4f71dcc4d54b8af0c44fe7b8150f5a Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 7 Feb 2019 10:47:39 +0100 Subject: [PATCH 2/2] nfsd: Fix lease time to 90 seconds The nfsd default lease time has been changed from 90 seconds to 45 seconds between Linux 4.14 and 4.19 by commit d6ebf5088f09 ("nfsd4: return default lease period"). After the upgrade of a nfs server (claptrap) from 4.14 to 4.19, we saw a failing process ("arplisten") and dmesg logs "NFS: nfs4_reclaim_open_state: Lock reclaim failed!" on a client (moep, 4.14.87). The client had the file system mounted with vers=4.0. Network trace indicated, that the client continued to use the 90 seconds lease period of the previous server incarnation and sent RENEWs every 60 seconds (2/3 of 90 seconds). Sometimes the server answered with NFS4ERR_EXPIRED. When this happened, the client executed recovery (SETCLIENTID...) but did non query the server for a new lease_time. So the problem was persistent even after the first failure. As an experiment, I've also restarted a server with the lease time decrement from 90 to 45 seconds, but the grace period fixed to 90 seconds. Now the client got NFS4ERR_STALE_CLIENTID but still did not query the server for a new lease_time and continued to send RENEWs in 60 second intervals. Add flags `--lease-time 90 and --grace-time 90` to nsfd to avoid upgrade complexity. Also change existing option `-N 3` to long form `--no-nfs-version 3` for readability. A `systemctl daemon-reload && systemctl restart nfsd` puts the new value into place as can be verified by `cat /proc/fs/nfsd/nfsv4leasetime`. --- misc_systemd_units/nfsd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc_systemd_units/nfsd.service b/misc_systemd_units/nfsd.service index 77e67aa..dbfd2af 100644 --- a/misc_systemd_units/nfsd.service +++ b/misc_systemd_units/nfsd.service @@ -8,7 +8,7 @@ After=local-fs.target proc-fs-nfsd.mount var-lib-nfs-rpc_pipefs.mount unbound.se ExecStartPre=/bin/mkdir -p /var/lib/nfs/v4recovery ExecStartPre=/usr/sbin/exportfs -ra ExecStart=/usr/sbin/rpc.mountd --foreground --manage-gids -ExecStartPost=/usr/sbin/rpc.nfsd -N 3 64 ; /usr/sbin/sm-notify +ExecStartPost=/usr/sbin/rpc.nfsd --lease-time 90 --grace-time 90 --no-nfs-version 3 64 ; /usr/sbin/sm-notify ExecReload=/usr/sbin/exportfs -ra ExecStopPost=/usr/sbin/rpc.nfsd 0 ; /usr/sbin/exportfs -ua Restart=always