[PATCH 15/31] mount.nfs: If port= specifies an unregistered port, retry, then fail

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

 



Suppose a port= option is specified on the mount command line, but not
enough other mount options are specified to avoid an rpcbind query to
discover the NFS service.

If the NFS service isn't registered on [100003, 3, "tcp", port] (even
if the server is listening on the specified port), the legacy mount.nfs
command fails immediately with:

 mount.nfs: mount to NFS server 'server' failed: RPC Error: Success

What's more, this mount request should succeeded if an NFS service is
registered on the specified port for another version and/or protocol.

So instead, let's retry the rpcbind query with the other versions and
transport protocols to be absolutely sure that port won't work with
either version or transport.  Then, if all fails, report:

 mount.nfs: mount to NFS server 'server' failed:
				RPC Error: Program not registered

This change also affects text-based mounts that require negotiation
by the mount.nfs command.

Note that if the mount options specify all four pmap parameters for
NFS, the rpcbind query for the NFS service is skipped entirely.  The
mount command then hangs and times out later if NFS service is not
listening on the requested tuple.  This is unchanged from previous
behavior.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---

 utils/mount/network.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index 9661995..73d64a2 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -567,7 +567,8 @@ static int nfs_probe_port(const struct sockaddr *sap, const socklen_t salen,
 				if (nfs_rpc_ping(saddr, salen, prog,
 							*p_vers, *p_prot, NULL))
 					goto out_ok;
-			}
+			} else
+				rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
 		}
 		if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED &&
 		    rpc_createerr.cf_stat != RPC_TIMEDOUT &&

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux