SUNRPC: Delay, then retry on connection errors.
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 11 Mar 2009 18:38:01 +0000 (14:38 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 11 Mar 2009 18:38:01 +0000 (14:38 -0400)
Enforce the comment in xs_tcp_connect_worker4/xs_tcp_connect_worker6 that
we should delay, then retry on certain connection errors.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/xprtsock.c

index 8e58b0b5460b0aa6258a8c69c8b69637f6a38a40..9f3e615d3e09ee27dfc1c000939ad5d099c3d463 100644 (file)
@@ -1722,20 +1722,19 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
                        xprt, -status, xprt_connected(xprt),
                        sock->sk->sk_state);
        switch (status) {
+       case -ECONNREFUSED:
+       case -ECONNRESET:
+       case -ENETUNREACH:
+               /* retry with existing socket, after a delay */
        case 0:
        case -EINPROGRESS:
        case -EALREADY:
                goto out_clear;
-       case -ECONNREFUSED:
-       case -ECONNRESET:
-               /* retry with existing socket, after a delay */
-               break;
-       default:
-               /* get rid of existing socket, and retry */
-               xs_tcp_shutdown(xprt);
-               printk("%s: connect returned unhandled error %d\n",
-                               __func__, status);
        }
+       /* get rid of existing socket, and retry */
+       xs_tcp_shutdown(xprt);
+       printk("%s: connect returned unhandled error %d\n",
+                       __func__, status);
        status = -EAGAIN;
 out:
        xprt_wake_pending_tasks(xprt, status);
@@ -1783,20 +1782,19 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
        dprintk("RPC:       %p connect status %d connected %d sock state %d\n",
                        xprt, -status, xprt_connected(xprt), sock->sk->sk_state);
        switch (status) {
+       case -ECONNREFUSED:
+       case -ECONNRESET:
+       case -ENETUNREACH:
+               /* retry with existing socket, after a delay */
        case 0:
        case -EINPROGRESS:
        case -EALREADY:
                goto out_clear;
-       case -ECONNREFUSED:
-       case -ECONNRESET:
-               /* retry with existing socket, after a delay */
-               break;
-       default:
-               /* get rid of existing socket, and retry */
-               xs_tcp_shutdown(xprt);
-               printk("%s: connect returned unhandled error %d\n",
-                               __func__, status);
        }
+       /* get rid of existing socket, and retry */
+       xs_tcp_shutdown(xprt);
+       printk("%s: connect returned unhandled error %d\n",
+                       __func__, status);
        status = -EAGAIN;
 out:
        xprt_wake_pending_tasks(xprt, status);