Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+18 −8
Original line number Original line Diff line number Diff line
@@ -1105,15 +1105,25 @@ 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) {
	case -EAGAIN:
		break;
	default:
		xprt_end_transmit(task);
		/*
		/*
	 * Special case: if we've been waiting on the socket's write_space()
		 * Special cases: if we've been waiting on the
	 * callback, then don't call xprt_end_transmit().
		 * socket's write_space() callback, or if the
		 * socket just returned a connection error,
		 * then hold onto the transport lock.
		 */
		 */
	if (task->tk_status == -EAGAIN)
	case -ECONNREFUSED:
		return;
	case -ENOTCONN:
	xprt_end_transmit(task);
	case -EHOSTDOWN:
	case -EHOSTUNREACH:
	case -ENETUNREACH:
		rpc_task_force_reencode(task);
		rpc_task_force_reencode(task);
	}
	}
}


/*
/*
 * 6.	Sort out the RPC call status
 * 6.	Sort out the RPC call status