Skip to contentSkip to conversation

mount: warning "namlen=" option for a NFSv4 mount

PATCH In review Chen Hanxiao 2 participants 2 messages Apr 3, 2024 – Apr 11, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount: warning "namlen=" option for a NFSv4 mount

namlen is not a valid option for NFSv4. Currently, we could pass a namlen=xxx in a NFSv4 mount, the mount command succeed and namlen is ignored silently

# mount -o vers=4,namlen=100 192.168.122.19:/nfsroot /mnt/ -vvv
mount.nfs: timeout set for Fri Mar 22 14:22:18 2024
mount.nfs: trying text-based options 'namlen=100,vers=4.2,
	   addr=192.168.122.19,clientaddr=192.168.122.15'

This patch will remove "namlen=" option in a NFSv4 mount, and give a warning message in verbose mode.

---
 utils/mount/stropts.c | 8 ++++++++
 1 file changed, 8 insertions(+)
utils/mount/stropts.c +8 -0
index dbdd11e7..a92c4200 100644
@@ -780,6 +780,14 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
 		goto out_fail;
 	}
 
+	if (po_contains(options, "namlen")) {
+		po_remove_all(options, "namlen");
+		if (verbose) {
+			printf(_("%s: Ignore unsupported nfs4 mount option 'namlen' in '%s'\n"),
+				progname, *mi->extra_opts);
+		}
+	}
+
 	if (mi->version.v_mode != V_SPECIFIC) {
 		char *fmt;
 		switch (mi->version.minor) {
Signature · 1 line
2.39.1
#1 lore raw
Quoted 9 lines · Chen Hanxiao

namlen is not a valid option for NFSv4. Currently, we could pass a namlen=xxx in a NFSv4 mount, the mount command succeed and namlen is ignored silently

# mount -o vers=4,namlen=100 192.168.122.19:/nfsroot /mnt/ -vvv
mount.nfs: timeout set for Fri Mar 22 14:22:18 2024
mount.nfs: trying text-based options 'namlen=100,vers=4.2,
	   addr=192.168.122.19,clientaddr=192.168.122.15'
Quoted 4 lines

This patch will remove "namlen=" option in a NFSv4 mount, and give a warning message in verbose mode.

Committed... (tag: nfs-utils-2-7-1-rc6

steved.

Quoted 23 lines
---
  utils/mount/stropts.c | 8 ++++++++
  1 file changed, 8 insertions(+)
utils/mount/stropts.c +8 -0
index dbdd11e7..a92c4200 100644
@@ -780,6 +780,14 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
  		goto out_fail;
  	}
 
+	if (po_contains(options, "namlen")) {
+		po_remove_all(options, "namlen");
+		if (verbose) {
+			printf(_("%s: Ignore unsupported nfs4 mount option 'namlen' in '%s'\n"),
+				progname, *mi->extra_opts);
+		}
+	}
+
  	if (mi->version.v_mode != V_SPECIFIC) {
  		char *fmt;
  		switch (mi->version.minor) {