Commit bd736ed3 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Don't handle errors if the bind/connect succeeded

Don't handle errors in call_bind_status()/call_connect_status()
if it turns out that a previous call caused it to succeed.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v5.1+
parent 06c9fdf3
...@@ -1970,6 +1970,7 @@ call_bind(struct rpc_task *task) ...@@ -1970,6 +1970,7 @@ call_bind(struct rpc_task *task)
static void static void
call_bind_status(struct rpc_task *task) call_bind_status(struct rpc_task *task)
{ {
struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
int status = -EIO; int status = -EIO;
if (rpc_task_transmitted(task)) { if (rpc_task_transmitted(task)) {
...@@ -1977,14 +1978,15 @@ call_bind_status(struct rpc_task *task) ...@@ -1977,14 +1978,15 @@ call_bind_status(struct rpc_task *task)
return; return;
} }
if (task->tk_status >= 0) {
dprint_status(task); dprint_status(task);
trace_rpc_bind_status(task);
if (task->tk_status >= 0)
goto out_next;
if (xprt_bound(xprt)) {
task->tk_status = 0; task->tk_status = 0;
task->tk_action = call_connect; goto out_next;
return;
} }
trace_rpc_bind_status(task);
switch (task->tk_status) { switch (task->tk_status) {
case -ENOMEM: case -ENOMEM:
dprintk("RPC: %5u rpcbind out of memory\n", task->tk_pid); dprintk("RPC: %5u rpcbind out of memory\n", task->tk_pid);
...@@ -2043,7 +2045,9 @@ call_bind_status(struct rpc_task *task) ...@@ -2043,7 +2045,9 @@ call_bind_status(struct rpc_task *task)
rpc_call_rpcerror(task, status); rpc_call_rpcerror(task, status);
return; return;
out_next:
task->tk_action = call_connect;
return;
retry_timeout: retry_timeout:
task->tk_status = 0; task->tk_status = 0;
task->tk_action = call_bind; task->tk_action = call_bind;
...@@ -2090,6 +2094,7 @@ call_connect(struct rpc_task *task) ...@@ -2090,6 +2094,7 @@ call_connect(struct rpc_task *task)
static void static void
call_connect_status(struct rpc_task *task) call_connect_status(struct rpc_task *task)
{ {
struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
struct rpc_clnt *clnt = task->tk_client; struct rpc_clnt *clnt = task->tk_client;
int status = task->tk_status; int status = task->tk_status;
...@@ -2099,8 +2104,17 @@ call_connect_status(struct rpc_task *task) ...@@ -2099,8 +2104,17 @@ call_connect_status(struct rpc_task *task)
} }
dprint_status(task); dprint_status(task);
trace_rpc_connect_status(task); trace_rpc_connect_status(task);
if (task->tk_status == 0) {
clnt->cl_stats->netreconn++;
goto out_next;
}
if (xprt_connected(xprt)) {
task->tk_status = 0;
goto out_next;
}
task->tk_status = 0; task->tk_status = 0;
switch (status) { switch (status) {
case -ECONNREFUSED: case -ECONNREFUSED:
...@@ -2131,13 +2145,12 @@ call_connect_status(struct rpc_task *task) ...@@ -2131,13 +2145,12 @@ call_connect_status(struct rpc_task *task)
case -EAGAIN: case -EAGAIN:
case -ETIMEDOUT: case -ETIMEDOUT:
goto out_retry; goto out_retry;
case 0:
clnt->cl_stats->netreconn++;
task->tk_action = call_transmit;
return;
} }
rpc_call_rpcerror(task, status); rpc_call_rpcerror(task, status);
return; return;
out_next:
task->tk_action = call_transmit;
return;
out_retry: out_retry:
/* Check for timeouts before looping back to call_bind */ /* Check for timeouts before looping back to call_bind */
task->tk_action = call_bind; task->tk_action = call_bind;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment