Commit 15f081ca authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Avoid an unnecessary task reschedule on ENOTCONN

If the socket is unconnected, and xprt_transmit() returns ENOTCONN, we
currently give up the lock on the transport channel. Doing so means that
the lock automatically gets assigned to the next task in the xprt->sending
queue, and so that task needs to be woken up to do the actual connect.

The following patch aims to avoid that unnecessary task switch.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent a67d18f8
...@@ -1105,14 +1105,24 @@ static void ...@@ -1105,14 +1105,24 @@ static void
call_transmit_status(struct rpc_task *task) call_transmit_status(struct rpc_task *task)
{ {
task->tk_action = call_status; task->tk_action = call_status;
/* switch (task->tk_status) {
* Special case: if we've been waiting on the socket's write_space() case -EAGAIN:
* callback, then don't call xprt_end_transmit(). break;
*/ default:
if (task->tk_status == -EAGAIN) xprt_end_transmit(task);
return; /*
xprt_end_transmit(task); * Special cases: if we've been waiting on the
rpc_task_force_reencode(task); * socket's write_space() callback, or if the
* socket just returned a connection error,
* then hold onto the transport lock.
*/
case -ECONNREFUSED:
case -ENOTCONN:
case -EHOSTDOWN:
case -EHOSTUNREACH:
case -ENETUNREACH:
rpc_task_force_reencode(task);
}
} }
/* /*
......
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