[PATCH 2/2] mount.nfs: Don't try NFSv4 if UDP was requested

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If no version was specified on the command line, but UDP is requested,
don't attempt an NFSv4 mount.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---

 utils/mount/stropts.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 94e75be..17ba48a 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -92,7 +92,8 @@ struct nfsmount_info {
 	struct mount_options	*options;	/* parsed mount options */
 	char			**extra_opts;	/* string for /etc/mtab */
 
-	unsigned long		version;	/* NFS version */
+	unsigned long		version,	/* NFS version */
+				protocol;	/* transport protocol */
 	int			flags,		/* MS_ flags */
 				fake,		/* actually do the mount? */
 				child;		/* forked bg child? */
@@ -361,6 +362,9 @@ static int nfs_validate_options(struct nfsmount_info *mi)
 	if (!nfs_set_version(mi))
 		return 0;
 
+	if (!nfs_nfs_protocol(mi->options, &mi->protocol))
+		return 0;
+
 	if (!nfs_append_sloppy_option(mi->options))
 		return 0;
 
@@ -761,6 +765,13 @@ static int nfs_autonegotiate(struct nfsmount_info *mi)
 	int result;
 
 	/*
+	 * Try only NFSv2/v3 if a transport protocol was
+	 * specified on the command line.
+	 */
+	if (mi->protocol == IPPROTO_UDP)
+		goto fall_back;
+
+	/*
 	 * Before 2.6.31, the kernel NFS client didn't support
 	 * "-t nfs vers=4" mounts, so we can't include NFSv4
 	 * when autonegotiating.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux