Blog/NFSv4 Client Tracking Daemon
NFSv4 Client Tracking Daemon[edit | edit source]

NFSv4 introduces stateful tracking of client-server interactions, unlike NFSv3, which is stateless.
The Linux kernel NFSv4 server originally stored client tracking data statefully on disk, using the directory specified by /proc/fs/nfsd/nfsv4recoverydir
. However, this method was deprecated in favour of an external daemon: nfsdcld
.
The nfsdcld
daemon, included in the nfs-utils package, manages NFSv4 client tracking in user space. This improves reliability compared to the legacy in-kernel tracking method.
Kernel Configuration and Future Changes[edit | edit source]
The legacy in-kernel client tracking mechanism is controlled by the kernel configuration option CONFIG_NFSD_LEGACY_CLIENT_TRACKING
. If this option is disabled in the kernel, then nfsdcld
required for NFSv4 client tracking to function correctly.
It is expected that CONFIG_NFSD_LEGACY_CLIENT_TRACKING
may be removed entirely in a future kernel version, making nfsdcld
mandatory for all NFSv4 deployments.
OpenRC Init Script for nfsdcld[edit | edit source]
I am using Gentoo and Alpine Linux, both OpenRC-based systems. They include nfsdcld
, but not an init script to start it.
The following OpenRC init script ensures that rpc.pipefs
is started and that the nfsd.ko
kernel module is loaded before attempting to start nfsdcld
itself.
#!/sbin/openrc-run
# Distributed under the terms of the GNU General Public License v2
name="nfsdcld"
description="NFSv4 Client Tracking Daemon"
command=/usr/sbin/nfsdcld
depend() {
before nfs
need rpc.pipefs
}
start_pre() {
checkpath -d -m 0700 -o root:root /var/lib/nfs/nfsdcld
if ! grep -qs nfsd /proc/filesystems ; then
modprobe -q nfsd
fi
}
When nfsdcld is not running, the NFS server logs a warning in dmesg:
[ 30.739668] NFSD: Unable to initialize client recovery tracking! (-110)
[ 30.739678] NFSD: Is nfsdcld running? If not, enable CONFIG_NFSD_LEGACY_CLIENT_TRACKING.
[ 30.739682] NFSD: starting 90-second grace period (net f0000000)
When nfsdcld is running properly, the kernel confirms that it is being used:
[ 46.361531] NFSD: Using nfsdcld client tracking operations.
[ 46.361535] NFSD: starting 90-second grace period (net f0000000)