Skip to contentSkip to conversation

NFS: Use the NFS_DEFAULT_VERSION for v2 and v3 mounts

PATCH In review [email protected] 2 participants 2 messages Jun 8, 2012

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

PATCH 1/1 NFS: Use the NFS_DEFAULT_VERSION for v2 and v3 mounts

From: Bryan Schumaker <[email protected]>

Older versions of nfs utils don't always pass a "vers=" mount option for NFS. This chould lead to attempts at using NFS v0 due to a zeroed out nfs_parsed_mount_data struct. I solve this by setting the default NFS version to NFS_DEFAULT_VERSION in the v2 and v3 cases (v4 has already been taken care of by a similar patch).

---
 fs/nfs/super.c |    1 +
 1 file changed, 1 insertion(+)
fs/nfs/super.c +1 -0
index ff656c0..97a3b30 100644
@@ -1867,6 +1867,7 @@ static int nfs23_validate_mount_data(void *options,
 	if (data == NULL)
 		goto out_no_data;
 
+	args->version = NFS_DEFAULT_VERSION;
 	switch (data->version) {
 	case 1:
 		data->namlen = 0;
Signature · 1 line
1.7.10.3
#1 lore raw
Quoted 9 lines · On Fri, Jun 08, 2012 at 11:32:56AM -0400, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

Older versions of nfs utils don't always pass a "vers=" mount option for NFS. This chould lead to attempts at using NFS v0 due to a zeroed out nfs_parsed_mount_data struct. I solve this by setting the default NFS version to NFS_DEFAULT_VERSION in the v2 and v3 cases (v4 has already been taken care of by a similar patch).

8bytes.org

Quoted 10 lines
---
 fs/nfs/super.c |    1 +
 1 file changed, 1 insertion(+)
fs/nfs/super.c +0 -0
index ff656c0..97a3b30 100644

fs/nfs/super.c static int nfs23_validate_mount_data(void *options, · line 1873

Quoted 7 lines
fs/nfs/super.c +1 -0
@@ -1867,6 +1867,7 @@ static int nfs23_validate_mount_data(void *options,
 	if (data == NULL)
 		goto out_no_data;
 
+	args->version = NFS_DEFAULT_VERSION;
 	switch (data->version) {
 	case 1:
 		data->namlen = 0;

Hmm, I still think that the revert-patch is a better solution. The data-structure is allocated and initialized in nfs_alloc_parsed_mount_data() so this function is the logical place to also initialize the version-field with a meaningful value.

Regards,

Joerg