Skip to contentSkip to conversation

NFS: suppressing showing of default mount port value in /proc fixed

PATCH Superseded Stanislav Kinsbursky 2 participants 5 messages Dec 3, 2010 – Dec 6, 2010

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: suppressing showing of default mount port value in /proc fixed

Default value for mount server port is set to NFS_UNSPEC_PORT (-1) and will not be changed during parsing mount options for mound data version 6. This default value will be showed for mountport in /proc/mounts always since current default check is for zero value. This small mistake leads to big problem, because during umount.nfs execution from old user-space utils (at least nfs-utils 1.0.9) this value will be used as the server port to connect to. This request will be rejected (since port is 65535) and thus nfs mount point can't be unmounted.

Kernel version affected: 2.6.37-rc4

---
 fs/nfs/super.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/super.c +2 -1
index 6d6e21d..fd4cac8 100644
@@ -681,7 +681,8 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
 
 	if (nfss->mountd_version || showdefaults)
 		seq_printf(m, ",mountvers=%u", nfss->mountd_version);
-	if (nfss->mountd_port || showdefaults)
+	if (nfss->mountd_port != (unsigned short)NFS_UNSPEC_PORT ||
+			showdefaults)
 		seq_printf(m, ",mountport=%u", nfss->mountd_port);
 
 	nfs_show_mountd_netid(m, nfss, showdefaults);
#1 lore raw
Quoted 8 lines · Stanislav Kinsbursky

Default value for mount server port is set to NFS_UNSPEC_PORT (-1) and will not be changed during parsing mount options for mound data version 6. This default value will be showed for mountport in /proc/mounts always since current default check is for zero value. This small mistake leads to big problem, because during umount.nfs execution from old user-space utils (at least nfs-utils 1.0.9) this value will be used as the server port to connect to. This request will be rejected (since port is 65535) and thus nfs mount point can't be unmounted.

Note: this is only possible if /etc/mtab is a link to /proc/mounts. Not all systems have this configuration.

Quoted 28 lines

Kernel version affected: 2.6.37-rc4

---
fs/nfs/super.c | 3 ++-

1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/super.c +2 -2
index 6d6e21d..fd4cac8 100644
@@ -681,7 +681,8 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
 
 	if (nfss->mountd_version || showdefaults)
 		seq_printf(m, ",mountvers=%u", nfss->mountd_version);
-	if (nfss->mountd_port || showdefaults)
+	if (nfss->mountd_port != (unsigned short)NFS_UNSPEC_PORT ||
+			showdefaults)
 		seq_printf(m, ",mountport=%u", nfss->mountd_port);
 
 	nfs_show_mountd_netid(m, nfss, showdefaults);
 
--

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
#2 lore raw

03.12.2010 20:35, Chuck Lever пишет:

Quoted 12 lines · Stanislav Kinsbursky
Quoted 9 lines

Default value for mount server port is set to NFS_UNSPEC_PORT (-1) and will not be changed during parsing mount options for mound data version 6. This default value will be showed for mountport in /proc/mounts always since current default check is for zero value. This small mistake leads to big problem, because during umount.nfs execution from old user-space utils (at least nfs-utils 1.0.9) this value will be used as the server port to connect to. This request will be rejected (since port is 65535) and thus nfs mount point can't be unmounted.

Quoted 2 lines

Note: this is only possible if /etc/mtab is a link to /proc/mounts. Not all systems have this configuration.

I found it on CentOs 5.5 with RHEL6 kernel.
Actually, the current patch has a specific flaw: if mount port is not passed by nfs utils using mount options version 6, then it will be set to 0 and showed in /proc/mounts as "mountport=0". Another fix solution is to call "nfs_set_port(sap, &args->nfs_server.port, 0);" when parsing mount options version 6 (like in done in default casein nfs_validate_mount_data) instead of changing nfs_show_mountd_options().

Quoted 29 lines
Quoted 28 lines

Kernel version affected: 2.6.37-rc4

---
fs/nfs/super.c | 3 ++-

1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/super.c +2 -2
index 6d6e21d..fd4cac8 100644
@@ -681,7 +681,8 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
 
 	if (nfss->mountd_version || showdefaults)
 		seq_printf(m, ",mountvers=%u", nfss->mountd_version);
-	if (nfss->mountd_port || showdefaults)
+	if (nfss->mountd_port != (unsigned short)NFS_UNSPEC_PORT ||
+			showdefaults)
 		seq_printf(m, ",mountport=%u", nfss->mountd_port);
 
 	nfs_show_mountd_netid(m, nfss, showdefaults);
 
--

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
Best regards,
Stanislav Kinsbursky
#3 lore raw
Quoted 13 lines · Kinsbursky Stanislav

03.12.2010 20:35, Chuck Lever пишет:

Quoted 12 lines · Stanislav Kinsbursky
Quoted 9 lines

Default value for mount server port is set to NFS_UNSPEC_PORT (-1) and will not be changed during parsing mount options for mound data version 6. This default value will be showed for mountport in /proc/mounts always since current default check is for zero value. This small mistake leads to big problem, because during umount.nfs execution from old user-space utils (at least nfs-utils 1.0.9) this value will be used as the server port to connect to. This request will be rejected (since port is 65535) and thus nfs mount point can't be unmounted.

Quoted 5 lines
Quoted 2 lines

Note: this is only possible if /etc/mtab is a link to /proc/mounts. Not all systems have this configuration.

I found it on CentOs 5.5 with RHEL6 kernel.
Actually, the current patch has a specific flaw: if mount port is not passed by nfs utils using mount options version 6, then it will be set to 0 and showed in /proc/mounts as "mountport=0".

Right: zero and negative one are both special internal port values that should not be displayed in /proc/mounts. Why not check if mountport > 0 instead?

Quoted 1 line

Another fix solution is to call "nfs_set_port(sap, &args->nfs_server.port, 0);" when parsing mount options version 6 (like in done in default casein nfs_validate_mount_data) instead of changing nfs_show_mountd_options().

I'm not sure I follow here. Why would setting nfsport be the right thing to do? The default case is for text-based mounts only.

Quoted 33 lines

Kernel version affected: 2.6.37-rc4

Quoted 27 lines
Quoted 26 lines

---
fs/nfs/super.c | 3 ++-

1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/super.c +2 -2
index 6d6e21d..fd4cac8 100644
@@ -681,7 +681,8 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
 
 	if (nfss->mountd_version || showdefaults)
 		seq_printf(m, ",mountvers=%u", nfss->mountd_version);
-	if (nfss->mountd_port || showdefaults)
+	if (nfss->mountd_port != (unsigned short)NFS_UNSPEC_PORT ||
+			showdefaults)
 		seq_printf(m, ",mountport=%u", nfss->mountd_port);
 
 	nfs_show_mountd_netid(m, nfss, showdefaults);
 
--

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
Best regards,
Stanislav Kinsbursky
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#4 lore raw

03.12.2010 21:17, Chuck Lever пишет:

Quoted 16 lines · Kinsbursky Stanislav
Quoted 14 lines

03.12.2010 20:35, Chuck Lever пишет:

Quoted 12 lines · Stanislav Kinsbursky
Quoted 9 lines

Default value for mount server port is set to NFS_UNSPEC_PORT (-1) and will not be changed during parsing mount options for mound data version 6. This default value will be showed for mountport in /proc/mounts always since current default check is for zero value. This small mistake leads to big problem, because during umount.nfs execution from old user-space utils (at least nfs-utils 1.0.9) this value will be used as the server port to connect to. This request will be rejected (since port is 65535) and thus nfs mount point can't be unmounted.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Note: this is only possible if /etc/mtab is a link to /proc/mounts. Not all systems have this configuration.

I found it on CentOs 5.5 with RHEL6 kernel.
Actually, the current patch has a specific flaw: if mount port is not passed by nfs utils using mount options version 6, then it will be set to 0 and showed in /proc/mounts as "mountport=0".

Right: zero and negative one are both special internal port values that should not be displayed in /proc/mounts. Why not check if mountport> 0 instead?

Yep, you right. I'll sent second version.

Quoted 38 lines
Quoted 1 line

Another fix solution is to call "nfs_set_port(sap,&args->nfs_server.port, 0);" when parsing mount options version 6 (like in done in default casein nfs_validate_mount_data) instead of changing nfs_show_mountd_options().

I'm not sure I follow here. Why would setting nfsport be the right thing to do? The default case is for text-based mounts only.

Quoted 33 lines

Kernel version affected: 2.6.37-rc4

Quoted 20 lines
Quoted 20 lines

---
fs/nfs/super.c | 3 ++-

1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/super.c +2 -1
index 6d6e21d..fd4cac8 100644
@@ -681,7 +681,8 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
 
 	if (nfss->mountd_version || showdefaults)
 		seq_printf(m, ",mountvers=%u", nfss->mountd_version);
-	if (nfss->mountd_port || showdefaults)
+	if (nfss->mountd_port != (unsigned short)NFS_UNSPEC_PORT ||
+			showdefaults)
 		seq_printf(m, ",mountport=%u", nfss->mountd_port);
 
Quoted 7 lines
Quoted 6 lines
fs/nfs/super.c +0 -1
 	nfs_show_mountd_netid(m, nfss, showdefaults);
 
--

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

--
Best regards,
Stanislav Kinsbursky

Signature · 2 lines
Best regards,
Stanislav Kinsbursky