diff mbox

[2/2] mount.nfs: v4 mounts should fail when nfs4 is specified with -t flag

Message ID 20170519222510.31205-2-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson May 19, 2017, 10:25 p.m. UTC
When the pseudo root is set with fsid=0, explicit v4
mounts (set with the -t fstype mount flag) should
fail when the incorrect export is tried instead
of rolling back to v3.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/stropts.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 0fbb375..a56e965 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -315,9 +315,10 @@  static int nfs_set_version(struct nfsmount_info *mi)
 	if (!nfs_nfs_version(mi->options, &mi->version))
 		return 0;
 
-	if (strncmp(mi->type, "nfs4", 4) == 0)
+	if (strncmp(mi->type, "nfs4", 4) == 0) {
 		mi->version.major = 4;
-
+		mi->version.v_mode = V_SPECIFIC;
+	}
 	/*
 	 * Before 2.6.32, the kernel NFS client didn't
 	 * support "-t nfs vers=4" mounts, so NFS version