SUNRPC: Ensure that call_connect times out correctly
[pandora-kernel.git] / net / sunrpc / clnt.c
index f09b7db..5a1b8fa 100644 (file)
@@ -1529,9 +1529,13 @@ call_refreshresult(struct rpc_task *task)
        task->tk_action = call_refresh;
        switch (status) {
        case 0:
-               if (rpcauth_uptodatecred(task))
+               if (rpcauth_uptodatecred(task)) {
                        task->tk_action = call_allocate;
-               return;
+                       return;
+               }
+               /* Use rate-limiting and a max number of retries if refresh
+                * had status 0 but failed to update the cred.
+                */
        case -ETIMEDOUT:
                rpc_delay(task, 3*HZ);
        case -EAGAIN:
@@ -1729,6 +1733,7 @@ call_bind_status(struct rpc_task *task)
                return;
        case -ECONNREFUSED:             /* connection problems */
        case -ECONNRESET:
+       case -ECONNABORTED:
        case -ENOTCONN:
        case -EHOSTDOWN:
        case -EHOSTUNREACH:
@@ -1793,19 +1798,19 @@ call_connect_status(struct rpc_task *task)
        trace_rpc_connect_status(task, status);
        task->tk_status = 0;
        switch (status) {
-               /* if soft mounted, test if we've timed out */
-       case -ETIMEDOUT:
-               task->tk_action = call_timeout;
-               return;
        case -ECONNREFUSED:
        case -ECONNRESET:
+       case -ECONNABORTED:
        case -ENETUNREACH:
+       case -EHOSTUNREACH:
                /* retry with existing socket, after a delay */
                rpc_delay(task, 3*HZ);
                if (RPC_IS_SOFTCONN(task))
                        break;
        case -EAGAIN:
-               task->tk_action = call_bind;
+               /* Check for timeouts before looping back to call_bind */
+       case -ETIMEDOUT:
+               task->tk_action = call_timeout;
                return;
        case 0:
                clnt->cl_stats->netreconn++;
@@ -1902,6 +1907,7 @@ call_transmit_status(struct rpc_task *task)
                        break;
                }
        case -ECONNRESET:
+       case -ECONNABORTED:
        case -ENOTCONN:
        case -EPIPE:
                rpc_task_force_reencode(task);
@@ -2011,8 +2017,9 @@ call_status(struct rpc_task *task)
                        xprt_conditional_disconnect(req->rq_xprt,
                                        req->rq_connect_cookie);
                break;
-       case -ECONNRESET:
        case -ECONNREFUSED:
+       case -ECONNRESET:
+       case -ECONNABORTED:
                rpc_force_rebind(clnt);
                rpc_delay(task, 3*HZ);
        case -EPIPE: