Skip to contentSkip to conversation

nfsmount.conf: New variables that explicitly set default (Release 3)

PATCH In review Steve Dickson 2 participants 6 messages Oct 17, 2009 – Oct 22, 2009 1 message not in the archive

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

cover nfsmount.conf: New variables that explicitly set default (Release 3)

Here is an update to my previous patch that allow the setting of both the protocol version and network version from the mount configuration file. Here is the original justification:

    http://marc.info/?l=linux-nfs&m=125511238831199&w=2

In this release two global variables are used to keep the default values set in the configuration file. These values are then used to initialize the values used in the server negotiation.

This patch set can be found on the 'mntconf_v3' branch on my experimental git tree:
git://linux-nfs.org/nfs-utils-exp

Comments?

steved.

#2 lore raw

PATCH 1/3 nfsmount.conf: New variables that explicitly set default (Release 3)

In reply to a message not in the archive

commit c41c16fca30b30796e66d997c1ad504d128f76b6

Author: Steve Dickson <[email protected]>
Date:   Sat Oct 17 09:16:18 2009 -0400

Introducing the parsing of both 'defaultvers' and 'defaultproto' config variables which will be used to set the the default version and network protocol.

A global variable will be set for each option with the corresponding value. The value will be used as the initial value in the server negation.

support/include/conffile.h +7 -0
index 672020a..fe23ec2 100644
@@ -75,4 +75,11 @@ static inline void upper2lower(char *str)
 	while ((c = tolower(*str)))
 		*str++ = c;
 }
+
+/*
+ * Default Mount options
+ */
+extern unsigned long config_default_vers;
+extern unsigned long config_default_proto;
+
 #endif				/* _CONFFILE_H_ */
utils/mount/configfile.c +56 -1

90 lines not on this page · raw message

utils/mount/network.c +1 -1
index bd621be..1a05351 100644
@@ -1261,7 +1261,7 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
  * Returns TRUE if @protocol contains a valid value for this option,
  * or FALSE if the option was specified with an invalid value.
  */
-static int
+int
 nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol)
 {
 	char *option;
utils/mount/network.h +2 -0
index 402e0a5..7eb89b0 100644
@@ -57,6 +57,8 @@ int clnt_ping(struct sockaddr_in *, const unsigned long,
 struct mount_options;
 
 int nfs_nfs_version(struct mount_options *options, unsigned long *version);
+int  nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol);
+
 int nfs_options2pmap(struct mount_options *,
 		      struct pmap *, struct pmap *);
 
#3 lore raw

PATCH 2/3 nfsmount.conf: New variables that explicitly set default (Release 3)

In reply to a message not in the archive

commit dbab932b4563744084d7ea22ad593173295e494e

Author: Steve Dickson <[email protected]>
Date:   Sat Oct 17 09:26:18 2009 -0400

Use the default protocol and version values, when they are set in the configuration file, to start the negation with the server

utils/mount/network.c +13 -3
index 1a05351..e651167 100644
@@ -50,6 +50,7 @@
 #include "nfsrpc.h"
 #include "parse_opt.h"
 #include "network.h"
+#include "conffile.h"
 
 #define PMAP_TIMEOUT	(10)
 #define CONNECT_TIMEOUT	(20)
@@ -609,10 +610,19 @@ static int nfs_probe_nfsport(const struct sockaddr *sap, const socklen_t salen,
 	if (pmap->pm_vers && pmap->pm_prot && pmap->pm_port)
 		return 1;
 
-	if (nfs_mount_data_version >= 4)
+	if (nfs_mount_data_version >= 4) {
+		const unsigned int *probe_proto = probe_tcp_first;
+
+		/*
+		 * If the default proto has been set and 
+		 * its not TCP, start with UDP
+		 */
+		if (config_default_proto && config_default_proto != IPPROTO_TCP)
+			probe_proto =  probe_udp_first;
+
 		return nfs_probe_port(sap, salen, pmap,
-					probe_nfs3_first, probe_tcp_first);
-	else
+					probe_nfs3_first, probe_proto);
+	} else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_nfs2_only, probe_udp_only);
 }
utils/mount/stropts.c +9 -0
index 069bdc1..ceefdb0 100644
@@ -45,6 +45,7 @@
 #include "parse_opt.h"
 #include "version.h"
 #include "parse_dev.h"
+#include "conffile.h"
 
 #ifndef NFS_PROGRAM
 #define NFS_PROGRAM	(100003)
@@ -283,6 +284,14 @@ static int nfs_validate_options(struct nfsmount_info *mi)
 		if (option && strcmp(option, "rdma") == 0)
 			mi->version = 3;
 	}
+	/*
+	 * Use the default value set in the config file when
+	 * the version has not been explicitly set.
+	 */
+	if (mi->version == 0 && config_default_vers) {
+		if (config_default_vers < 4)
+			mi->version = config_default_vers;
+	}
 
 	if (!nfs_append_sloppy_option(mi->options))
 		return 0;
#4 lore raw

PATCH 3/3 nfsmount.conf: New variables that explicitly set default (Release 3)

In reply to a message not in the archive

commit 04f6cc992b99d09855736bccf33f1eb96af82244

Author: Steve Dickson <[email protected]>
Date:   Mon Oct 12 17:16:56 2009 -0400

Added the defaultproto and defaultvers variable to the mount configuration file.

utils/mount/nfsmount.conf +18 -4
index 991838f..0d65056 100644
@@ -28,10 +28,24 @@
 # This statically named section defines global mount 
 # options that can be applied on all NFS mount.
 #
-# Protocol Version [2,3]
-# Nfsvers=3
-#
-# Network Transport [udp,tcp,rdma] (Note: values are case sensitive)
+# Protocol Version [2,3,4]
+# This defines the default protocol version which will
+# be used to start the negotiation with the server.
+# Defaultvers=4
+#
+# Setting this option makes it mandatory the server supports the
+# given version. The mount will fail if the given version is 
+# not support by the server. 
+# Nfsvers=4
+#
+# Network Protocol [udp,tcp,rdma] (Note: values are case sensitive)
+# This defines the default network protocol which will
+# be used to start the negotiation with the server.
+# Defaultproto=tcp
+#
+# Setting this option makes it mandatory the server supports the
+# given network protocol. The mount will fail if the given network
+# protocol is not supported by the server.
 # Proto=tcp
 #
 # The number of times a request will be retired before 
#5 lore raw
In reply to a message not in the archive
Quoted 11 lines · Steve Dickson

Here is an update to my previous patch that allow the setting of both the protocol version and network version from the mount configuration file. Here is the original justification:

   http://marc.info/?l=linux-nfs&m=125511238831199&w=2

In this release two global variables are used to keep the default values set in the configuration file. These values are then used to initialize the values used in the server negotiation.

Quoted 6 lines

This patch set can be found on the 'mntconf_v3' branch on my experimental git tree:
git://linux-nfs.org/nfs-utils-exp

Comments?

Much simpler, eh? I think this is closer but I would like to study it a little more. I will post more specific comments tomorrow.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#6 lore raw
In reply to a message not in the archive
Quoted 6 lines · Steve Dickson

Here is an update to my previous patch that allow the setting of both the protocol version and network version from the mount configuration file. Here is the original justification:

    http://marc.info/?l=linux-nfs&m=125511238831199&w=2
Quoted 10 lines

In this release two global variables are used to keep the default values set in the configuration file. These values are then used to initialize the values used in the server negotiation.

This patch set can be found on the 'mntconf_v3' branch on my experimental git tree:
git://linux-nfs.org/nfs-utils-exp

Committed..

steved.