Skip to contentSkip to conversation

The beginning of the end of v2 support

PATCH New Steve Dickson 2 participants 5 messages Apr 12, 2013 – Apr 22, 2013

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

PATCH 1/1 The beginning of the end of v2 support

The following patch is beginning of no longer supporting the NFS version 2 protocol. At this point there no valid reason outdated protocol should be used. Plus from a support/testing stand point its really becoming a thorn.

The following patch simply disables the v2 protocol negation by only negotiating to v3. Setting the version on the command will be the only way v2 can be used... for now!

Steve Dickson (1):
mount: No longer negotiate to v2

 utils/mount/network.c | 13 +++++--------
 utils/mount/stropts.c |  2 ++
 2 files changed, 7 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/1 mount: No longer negotiate to v2

This patch remove the ability of negotiating to the v2 protocol. Explicitly setting the version on the command line will be the only way to use v2.

---
 utils/mount/network.c | 13 +++++--------
 utils/mount/stropts.c |  2 ++
 2 files changed, 7 insertions(+), 8 deletions(-)
utils/mount/network.c +5 -8
index e7bd522..4be48cd 100644
@@ -155,9 +155,8 @@ static const unsigned long probe_nfs2_only[] = {
 	0,
 };
 
-static const unsigned long probe_nfs3_first[] = {
+static const unsigned long probe_nfs3_only[] = {
 	3,
-	2,
 	0,
 };
 
@@ -167,10 +166,8 @@ static const unsigned long probe_mnt1_first[] = {
 	0,
 };
 
-static const unsigned long probe_mnt3_first[] = {
+static const unsigned long probe_mnt3_only[] = {
 	3,
-	1,
-	2,
 	0,
 };
 
@@ -626,7 +623,7 @@ static int nfs_probe_nfsport(const struct sockaddr *sap, const socklen_t salen,
 		probe_proto = nfs_default_proto();
 
 		return nfs_probe_port(sap, salen, pmap,
-					probe_nfs3_first, probe_proto);
+					probe_nfs3_only, probe_proto);
 	} else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_nfs2_only, probe_udp_only);
@@ -653,7 +650,7 @@ static int nfs_probe_mntport(const struct sockaddr *sap, const socklen_t salen,
 
 	if (nfs_mount_data_version >= 4)
 		return nfs_probe_port(sap, salen, pmap,
-					probe_mnt3_first, probe_udp_first);
+					probe_mnt3_only, probe_udp_first);
 	else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_mnt1_first, probe_udp_only);
@@ -717,7 +714,7 @@ int nfs_probe_bothports(const struct sockaddr *mnt_saddr,
 	memcpy(&save_nfs, nfs_pmap, sizeof(save_nfs));
 	memcpy(&save_mnt, mnt_pmap, sizeof(save_mnt));
 	probe_vers = (nfs_mount_data_version >= 4) ?
-			probe_mnt3_first : probe_mnt1_first;
+			probe_mnt3_only : probe_mnt1_first;
 
 	for (; *probe_vers; probe_vers++) {
 		nfs_pmap->pm_vers = mntvers_to_nfs(*probe_vers);
utils/mount/stropts.c +2 -0
index 8ee3024..1dc38ef 100644
@@ -542,6 +542,8 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)
 			errno = EACCES;
 		else if (rpc_createerr.cf_stat == RPC_TIMEDOUT)
 			errno = ETIMEDOUT;
+		else if (rpc_createerr.cf_stat == RPC_PROGVERSMISMATCH)
+			errno = EPROTONOSUPPORT;
 		else if (rpc_createerr.cf_error.re_errno != 0)
 			errno = rpc_createerr.cf_error.re_errno;
 		return 0;
Signature · 1 line
1.8.1.4
#2 lore raw

Re: [PATCH] mount: No longer negotiate to v2

Quoted 3 lines · Steve Dickson

This patch remove the ability of negotiating to the v2 protocol. Explicitly setting the version on the command line will be the only way to use v2.

Just curious: is there a way to do this using the mount configuration file?

Quoted 80 lines

---
utils/mount/network.c | 13 +++++--------
utils/mount/stropts.c | 2 ++

2 files changed, 7 insertions(+), 8 deletions(-)
utils/mount/network.c +5 -8
index e7bd522..4be48cd 100644
@@ -155,9 +155,8 @@ static const unsigned long probe_nfs2_only[] = {
 	0,
 };
 
-static const unsigned long probe_nfs3_first[] = {
+static const unsigned long probe_nfs3_only[] = {
 	3,
-	2,
 	0,
 };
 
@@ -167,10 +166,8 @@ static const unsigned long probe_mnt1_first[] = {
 	0,
 };
 
-static const unsigned long probe_mnt3_first[] = {
+static const unsigned long probe_mnt3_only[] = {
 	3,
-	1,
-	2,
 	0,
 };
 
@@ -626,7 +623,7 @@ static int nfs_probe_nfsport(const struct sockaddr *sap, const socklen_t salen,
 		probe_proto = nfs_default_proto();
 
 		return nfs_probe_port(sap, salen, pmap,
-					probe_nfs3_first, probe_proto);
+					probe_nfs3_only, probe_proto);
 	} else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_nfs2_only, probe_udp_only);
@@ -653,7 +650,7 @@ static int nfs_probe_mntport(const struct sockaddr *sap, const socklen_t salen,
 
 	if (nfs_mount_data_version >= 4)
 		return nfs_probe_port(sap, salen, pmap,
-					probe_mnt3_first, probe_udp_first);
+					probe_mnt3_only, probe_udp_first);
 	else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_mnt1_first, probe_udp_only);
@@ -717,7 +714,7 @@ int nfs_probe_bothports(const struct sockaddr *mnt_saddr,
 	memcpy(&save_nfs, nfs_pmap, sizeof(save_nfs));
 	memcpy(&save_mnt, mnt_pmap, sizeof(save_mnt));
 	probe_vers = (nfs_mount_data_version >= 4) ?
-			probe_mnt3_first : probe_mnt1_first;
+			probe_mnt3_only : probe_mnt1_first;
 
 	for (; *probe_vers; probe_vers++) {
 		nfs_pmap->pm_vers = mntvers_to_nfs(*probe_vers);
utils/mount/stropts.c +2 -0
index 8ee3024..1dc38ef 100644
@@ -542,6 +542,8 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)
 			errno = EACCES;
 		else if (rpc_createerr.cf_stat == RPC_TIMEDOUT)
 			errno = ETIMEDOUT;
+		else if (rpc_createerr.cf_stat == RPC_PROGVERSMISMATCH)
+			errno = EPROTONOSUPPORT;
 		else if (rpc_createerr.cf_error.re_errno != 0)
 			errno = rpc_createerr.cf_error.re_errno;
 		return 0;
Signature · 6 lines
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#3 lore raw

Re: [PATCH] mount: No longer negotiate to v2

Quoted 6 lines · Chuck Lever
Quoted 3 lines · Steve Dickson
Quoted 3 lines

This patch remove the ability of negotiating to the v2 protocol. Explicitly setting the version on the command line will be the only way to use v2.

Just curious: is there a way to do this using the mount configuration file?

No. One can set the Nfsvers=2 for legacy servers if need be, but there is no mount option that controls the how the protocols are negotiated.

steved.

#4 lore raw

Re: [PATCH] mount: No longer negotiate to v2

In reply to Steve Dickson
Quoted 5 lines · Steve Dickson

This patch remove the ability of negotiating to the v2 protocol. Explicitly setting the version on the command line will be the only way to use v2.

Committed..

steved.

Quoted 73 lines
---
 utils/mount/network.c | 13 +++++--------
 utils/mount/stropts.c |  2 ++
 2 files changed, 7 insertions(+), 8 deletions(-)
utils/mount/network.c +5 -8
index e7bd522..4be48cd 100644
@@ -155,9 +155,8 @@ static const unsigned long probe_nfs2_only[] = {
 	0,
 };
 
-static const unsigned long probe_nfs3_first[] = {
+static const unsigned long probe_nfs3_only[] = {
 	3,
-	2,
 	0,
 };
 
@@ -167,10 +166,8 @@ static const unsigned long probe_mnt1_first[] = {
 	0,
 };
 
-static const unsigned long probe_mnt3_first[] = {
+static const unsigned long probe_mnt3_only[] = {
 	3,
-	1,
-	2,
 	0,
 };
 
@@ -626,7 +623,7 @@ static int nfs_probe_nfsport(const struct sockaddr *sap, const socklen_t salen,
 		probe_proto = nfs_default_proto();
 
 		return nfs_probe_port(sap, salen, pmap,
-					probe_nfs3_first, probe_proto);
+					probe_nfs3_only, probe_proto);
 	} else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_nfs2_only, probe_udp_only);
@@ -653,7 +650,7 @@ static int nfs_probe_mntport(const struct sockaddr *sap, const socklen_t salen,
 
 	if (nfs_mount_data_version >= 4)
 		return nfs_probe_port(sap, salen, pmap,
-					probe_mnt3_first, probe_udp_first);
+					probe_mnt3_only, probe_udp_first);
 	else
 		return nfs_probe_port(sap, salen, pmap,
 					probe_mnt1_first, probe_udp_only);
@@ -717,7 +714,7 @@ int nfs_probe_bothports(const struct sockaddr *mnt_saddr,
 	memcpy(&save_nfs, nfs_pmap, sizeof(save_nfs));
 	memcpy(&save_mnt, mnt_pmap, sizeof(save_mnt));
 	probe_vers = (nfs_mount_data_version >= 4) ?
-			probe_mnt3_first : probe_mnt1_first;
+			probe_mnt3_only : probe_mnt1_first;
 
 	for (; *probe_vers; probe_vers++) {
 		nfs_pmap->pm_vers = mntvers_to_nfs(*probe_vers);
utils/mount/stropts.c +2 -0
index 8ee3024..1dc38ef 100644
@@ -542,6 +542,8 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)
 			errno = EACCES;
 		else if (rpc_createerr.cf_stat == RPC_TIMEDOUT)
 			errno = ETIMEDOUT;
+		else if (rpc_createerr.cf_stat == RPC_PROGVERSMISMATCH)
+			errno = EPROTONOSUPPORT;
 		else if (rpc_createerr.cf_error.re_errno != 0)
 			errno = rpc_createerr.cf_error.re_errno;
 		return 0;