mount.nfs: fix hang when getport() uses TCP against unavailable servers
Subsystems (2)
PATCH 14/23 mount.nfs: fix hang when getport() uses TCP against unavailable servers
If get_socket() can't get us an open TCP socket, we know the server is down, so make getport() exit early instead of hanging. This logic is copied from clnt_ping().
Signed-off-by Chuck Lever <[email protected]>
---
utils/mount/network.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
utils/mount/network.c +17 -2
@@ -135,8 +135,23 @@ unsigned short getport(struct sockaddr_in *saddr, unsigned long prog,struct pmap parms;enum clnt_stat stat; - saddr->sin_port =htons (PMAPPORT ); - socket =get_socket (saddr, prot, FALSE, FALSE); + saddr->sin_port =htons (PMAPPORT ); + +/* +* Try to get a socket with a non-privileged port. +* clnt*create() will create one anyway if this +* fails. +*/ + socket =get_socket (saddr, proto, FALSE, FALSE); +if (socket ==RPC_ANYSOCK ) { +if (proto ==IPPROTO_TCP && errno ==ETIMEDOUT ) { +/* +* TCP SYN timed out, so exit now. +*/ + rpc_createerr.cf_stat =RPC_TIMEDOUT ; + } +return 0 ; + }switch (prot) {case IPPROTO_UDP :
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs