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

Bug#582003: nfs-common: nfs client ignores "port=2049" option when mounting



On Mon, 2010-05-17 at 17:23 +0200, Paul Millar wrote:
> Package: nfs-common
> Version: 1:1.2.2-1
> Severity: normal
> Tags: sid
> 
> Hi,
> 
> I'm trying to mount an NFS server that isn't registered in the portmapper.  I
> believe this has worked in the past and something changed moderately recently
> (probably between 2009-11-19 and 2010-5-1) that broke this behaviour.
> 
> The options supplied to mount (via -o) are:
> 
>         nfsvers=2,nolock,udp,noac,intr,rw,mountport=<mount>,port=2049
> 
> (where <mount> is the UDP port of the NFS mount daemon; the mount daemon isn't
> bound to some well-known port, but is discovered by a support script)
> 
> An attempt to mount the NFS server using the above options fails.  Watching the
> network traffic, I see the following SunRPC calls:
> 
>   1. SunRPC NULL call to a MOUNT service (running on UDP port <mount>) ... this
> is successful
>   2. SunRPC MNT call to a MOUNT service (running on UDP port <mount>) ... this
> is successful
>   3. SunRPC GETPORT call to Portmap service .. this is unsuccessful (no
> registered program)
> 
> The failing GETPORT call to portmapper is querying for program 10000003 (NFS),
> version 2, proto UDP.  The failure of this call is expected: the NFS server
> isn't registered in the portmapper service, so such a query should fail.
> However, what isn't clear is why the client is calling the Portmapper service
> since the port number has been supplied in the mount options ("port=2049")
[...]

Right.  For whatever reason, mount.nfs processes the options into a
canonical form and at this point it will lose the port=2049 option.
Please can you test the following patch:

--- nfs-utils-1.2.2.orig/utils/mount/stropts.c
+++ nfs-utils-1.2.2/utils/mount/stropts.c
@@ -434,8 +434,8 @@
 	if (po_append(options, new_option) == PO_FAILED)
 		return 0;
 
-	po_remove_all(options, "port");
-	if (nfs_pmap->pm_port != NFS_PORT) {
+	if (po_remove_all(options, "port") == PO_FOUND ||
+		nfs_pmap->pm_port != NFS_PORT) {
 		snprintf(new_option, sizeof(new_option) - 1,
 			 "port=%lu", nfs_pmap->pm_port);
 		if (po_append(options, new_option) == PO_FAILED)
--- END ---

You can find a version of the nfs-utils package including this patch
under <http://people.debian.org/~benh/>.

Ben.

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: