From be83269e3ebdd17b05f94fb64fdcf616c9d94b6f Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Tue, 17 Sep 2002 20:17:14 -0700 Subject: [PATCH] (1/2) clean up RPC over TCP transport socket connect This provides clean up and bug fixes for the RPC layer's TCP socket connection management logic. Trond, Alexey, and DaveM have seen this patch. i've been running it for several weeks here and feel it is ready for wider testing. these two patches are prerequisites for further clean-ups and fixes for RPC over TCP. bugs fixed: + TCP connection establishment now times out after 60 seconds instead of hanging for ten minutes. 60 seconds is more in line with how long a server takes to reboot. + on a soft-mounted file system, TCP reconnections now time out and fail the RPC request, like most other NFS clients, instead of hanging the NFS client until the server comes back. + on hard-mounted file systems, the RPC layer now delays 15 seconds before retrying after a failed connection attempt instead of retrying as soon as it can. + TCP connection error recovery is now more verbose so users can see why their NFS sessions are hung. this can be tuned with future patches if it is unreasonably noisy. + the TCP connect logic is cleaned up so adding checks for new errnos is easier. + the same code now handles both initial connection and reconnection. the original initial connection code did not have comprehensive error handling. + some obscure design elements are now documented in comments. + kfree was used by mistake in xprt_destroy. --- include/linux/sunrpc/xprt.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/linux') diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 2ce2c8223384..35ff9e0192e1 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -44,6 +44,19 @@ #define RPC_MAX_UDP_TIMEOUT (60*HZ) #define RPC_MAX_TCP_TIMEOUT (600*HZ) +/* + * Wait duration for an RPC TCP connection to be established. Solaris + * NFS over TCP uses 60 seconds, for example, which is in line with how + * long a server takes to reboot. + */ +#define RPC_CONNECT_TIMEOUT (60*HZ) + +/* + * Delay an arbitrary number of seconds before attempting to reconnect + * after an error. + */ +#define RPC_REESTABLISH_TIMEOUT (15*HZ) + /* RPC call and reply header size as number of 32bit words (verifier * size computed separately) */ -- cgit v1.2.3