Giving Linux mountd a '--no-nfs-version 4' argument does nothing

August 23, 2023

We're long time users specifically of NFS v3, not NFS v4, and so for a long time we also did everything we could to disable NFS v4 on our NFS servers. When our NFS servers became Linux ones in 2018, one of the things we did was to run mountd with a command line option to disable NFS v4:

/usr/sbin/rpc.mountd --no-nfs-version 4

(This required a customized nfs-mountd.service systemd unit.)

It's likely that we're going to move to NFS v4 due to NFS v3 locking problems, and as part of that we're testing the changes we need to make to our existing fileservers. As part of that, today I noticed that all of our fileservers were running mountd with this argument. Including the fileservers that we'd enabled NFS v4 on and had made NFS v4 mounts from.

Based on looking at the mountd code (in mountd.c, turning NFS v4 off (or on) in mountd has absolutely no effect. It doesn't even stop a modern mountd from logging NFS v4 client connections and disconnections, which look like this:

v4.2 client attached: 0x41a6accf64e644e2 from "128.100.X.X:840"
v4.2 client detached: 0x41a6accf64e644e2 from "128.100.X.X:840"

At one level this is unsurprising, because in NFS v4 the process for mounting exports was moved into the main NFS protocol and so the mountd daemon is no longer involved in it. Whether or not you can do NFS v4 mounts from a Linux fileserver is purely up to the kernel NFS server operating on port 2049, which depends on whether NFS v4 was enabled in the kernel server (which in turn is configured when rpc.nfsd runs, and is normally set and controlled in /etc/nfs.conf).

At another level I wish mountd had told me at some point, even in a warning message. We've been setting a pointless option and slightly complicating our fileserver installs for years.

(You might wonder how mountd notices NFS v4 clients attaching and detaching. The answer is in support/export/v4clients.c, and is that mountd monitors /proc/fs/nfsd/clients for things appearing, disappearing, and changing. Mountd could skip doing this if you told it that NFS v4 was disabled, but currently it doesn't.)

Written on 23 August 2023.
« We have a NFS v3 locking problem on our Ubuntu 22.04 servers
One challenge in reducing TLS certificate lifetimes down to 90 days »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Wed Aug 23 21:48:00 2023
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.