mount.nfs: Fix minor version parsing when '-t nfs4' and '-o vers=4.x' are used together
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nfs-utils (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Medium
|
Matthew Ruffell |
Bug Description
[Impact]
When specifying both '-t nfs4' and '-o vers=4.x' on the mount command line, mount.nfs ignores any specific version set with '-o vers=4.x' or '-o vers=4,
Users who specify what version they want should get the version they ask for, and thus, this is a regression introduced in 1:1.3.4-
A workaround is to drop '-t nfs4' and to use mount.nfs directly instead, i.e.:
$ sudo mount.nfs -o vers=4.1 -vvv jammy-nfs-server:/ /mnt
[Testcase]
Create two VMs, one jammy and one focal.
The jammy VM will be the server.
Server VM:
$ sudo hostnamectl set-hostname jammy-nfs-server
$ sudo apt update && sudo apt upgrade -y
$ sudo apt install nfs-kernel-server
$ sudo mkdir /export
$ sudo mkdir /export/users
$ sudo mkdir /home/users
$ sudo vi /etc/fstab # add the following line:
/home/users /export/users none bind 0 0
$ sudo mount -a
$ sudo vi /etc/exports # add the following lines:
/export 192.168.
/export/users 192.168.
$ sudo systemctl restart nfs-server.service
Focal VM:
$ sudo hostnamectl set-hostname focal-nfs-client
$ sudo apt update && sudo apt upgrade -y
$ sudo apt install nfs-common
And then try mounting with both '-t nfs4' and '-o vers=4.1':
$ sudo mount -t nfs4 -o vers=4.1 -vvv jammy-nfs-server:/ /mnt
mount.nfs4: timeout set for Wed Apr 3 00:51:23 2024
mount.nfs4: trying text-based options 'vers=4.
and then try with both '-t nfs4' and '-o vers=4,
$ sudo mount -t nfs4 -o vers=4,
mount.nfs4: timeout set for Wed Apr 3 02:19:03 2024
mount.nfs4: trying text-based options 'minorversion=
In each of those mounts, it incorrectly uses protocol version 4.2, instead of requested 4.1.
If you install the test packages in the following ppa:
https:/
then vers should always be 4.1, instead of 4.2.
[Where problems can occur]
It is quite clear now that changing version negotiation and parsing is quite problematic, after the number of regressions the previous 1:1.3.4-
We need to be careful, to make sure we don't introduce any further regressions.
This time, we are only changing how mount.nfs parses and processes command line arguments for version specification, and not changing version negotiation itself. This could impact NFS clients, when they go to mount NFS filesystems.
If a regression were to occur, then users might have to manually mount their NFS filesystems or look into autofs. There should be no breaking changes to any behaviour when mounting NFS filesystems.
There are no changes to nfs server.
[Other Info]
This was fixed multiple times, across the following three commits:
commit 1e3ca7fe199531a
Author: NeilBrown <email address hidden>
Date: Wed Jul 26 13:47:42 2017 -0400
Subject: mount: move handling of "-t nfs4" into nfs_nfs_version()
Link: https:/
commit 050153ef6a86ff5
Author: NeilBrown <email address hidden>
Date: Wed Jul 26 13:51:51 2017 -0400
Subject: mount: Fix problems with parsing minorversion=
Link: https:/
commit 71b807e1a69940b
Author: Steve Dickson <email address hidden>
Date: Thu Mar 1 13:52:47 2018 -0500
Subject: mount.nfs: minorversion setting is being ignored with the -t flag
Link: https:/
commit 5f32083c759b468
From: Steve Dickson <email address hidden>
Date: Tue, 10 Apr 2018 10:25:40 -0400
Subject: mount.nfs: Fix auto protocol negotiation
Link: https:/
Jammy has all of these, and does not need any fixes.
Subscribed mruffell who authored that particular SRU, for consideration.