SUNRPC: call_connect_status should recheck bind and connect status on error
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 26 Sep 2013 19:22:45 +0000 (15:22 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 1 Oct 2013 22:22:12 +0000 (18:22 -0400)
Currently, we go directly to call_transmit which sends us to call_status
on error. If we know that the connect attempt failed, we should rather
just jump straight back to call_bind and call_connect.

Ditto for EAGAIN, except do not delay.

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

index bde31159f63280f41684ffddebbb5823d5fcf005..7352aef8a25444e450e17e38bbe9bcbf81185ddc 100644 (file)
@@ -1692,6 +1692,7 @@ call_connect_status(struct rpc_task *task)
        dprint_status(task);
 
        trace_rpc_connect_status(task, status);
+       task->tk_status = 0;
        switch (status) {
                /* if soft mounted, test if we've timed out */
        case -ETIMEDOUT:
@@ -1700,12 +1701,14 @@ call_connect_status(struct rpc_task *task)
        case -ECONNREFUSED:
        case -ECONNRESET:
        case -ENETUNREACH:
+               /* retry with existing socket, after a delay */
+               rpc_delay(task, 3*HZ);
                if (RPC_IS_SOFTCONN(task))
                        break;
-               /* retry with existing socket, after a delay */
-       case 0:
        case -EAGAIN:
-               task->tk_status = 0;
+               task->tk_action = call_bind;
+               return;
+       case 0:
                clnt->cl_stats->netreconn++;
                task->tk_action = call_transmit;
                return;