walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
Blob Blame History Raw
commit 92e4d5c342f15940362fc2b2df19df0893f0dd13
Author: Neil Brown <neilb@suse.de>
Date:   Thu Aug 28 11:32:33 2008 -0400

    mount: enable retry for nfs23 to set the correct protocol for mount.
    
    Use a connected port when talking to portmap via UDP.
    
    This allows us to get ICMP errors reported back so we can avoid
    timeouts.  Also catch the error (RPC_CANTRECV) properly in getport.
    
    Signed-off-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Steve Dickson <steved@redhat.com>

diff --git a/utils/mount/network.c b/utils/mount/network.c
index 0023769..2db694d 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -465,7 +465,7 @@ static unsigned short getport(struct sockaddr_in *saddr,
 	bind_saddr = *saddr;
 	bind_saddr.sin_port = htons(PMAPPORT);
 
-	socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, FALSE);
+	socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, TRUE);
 	if (socket == RPC_ANYSOCK) {
 		if (proto == IPPROTO_TCP &&
 		    rpc_createerr.cf_error.re_errno == ETIMEDOUT)
@@ -554,6 +554,7 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions,
 		}
 		if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED &&
 		    rpc_createerr.cf_stat != RPC_TIMEDOUT &&
+		    rpc_createerr.cf_stat != RPC_CANTRECV &&
 		    rpc_createerr.cf_stat != RPC_PROGVERSMISMATCH)
 			goto out_bad;
 
@@ -562,7 +563,8 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions,
 				continue;
 			p_prot = protos;
 		}
-		if (rpc_createerr.cf_stat == RPC_TIMEDOUT)
+		if (rpc_createerr.cf_stat == RPC_TIMEDOUT ||
+		    rpc_createerr.cf_stat == RPC_CANTRECV)
 			goto out_bad;
 
 		if (vers || !*++p_vers)