summaryrefslogtreecommitdiffstats
path: root/utils/mount/network.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-07-14 16:29:11 -0400
committerSteve Dickson <steved@redhat.com>2009-07-14 16:29:11 -0400
commit5f7313a10b63da796d5cd79c01db1e097d4a6bf1 (patch)
treef754a9a7042a39bfa0a86e856264b9b78b37a8e7 /utils/mount/network.c
parent682a9855b93a7d3545a26eea39a0895b9757cdcb (diff)
downloadnfs-utils-5f7313a10b63da796d5cd79c01db1e097d4a6bf1.tar.gz
nfs-utils-5f7313a10b63da796d5cd79c01db1e097d4a6bf1.tar.xz
nfs-utils-5f7313a10b63da796d5cd79c01db1e097d4a6bf1.zip
mount.nfs: If port= specifies an unregistered port, retry, then fail
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@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mount/network.c')
-rw-r--r--utils/mount/network.c3
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 &&