diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-11 14:37:57 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-11 14:37:57 -0400 |
commit | 15f081ca8ddfe150fb639c591b18944a539da0fc (patch) | |
tree | 24261e97034770ab827d153cc541222e04701ac3 | |
parent | a67d18f89f5782806135aad4ee012ff78d45aae7 (diff) |
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: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | net/sunrpc/clnt.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 836f15c0c4a3..07e9b05321e6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1105,14 +1105,24 @@ static void | |||
1105 | call_transmit_status(struct rpc_task *task) | 1105 | call_transmit_status(struct rpc_task *task) |
1106 | { | 1106 | { |
1107 | task->tk_action = call_status; | 1107 | task->tk_action = call_status; |
1108 | /* | 1108 | switch (task->tk_status) { |
1109 | * Special case: if we've been waiting on the socket's write_space() | 1109 | case -EAGAIN: |
1110 | * callback, then don't call xprt_end_transmit(). | 1110 | break; |
1111 | */ | 1111 | default: |
1112 | if (task->tk_status == -EAGAIN) | 1112 | xprt_end_transmit(task); |
1113 | return; | 1113 | /* |
1114 | xprt_end_transmit(task); | 1114 | * Special cases: if we've been waiting on the |
1115 | rpc_task_force_reencode(task); | 1115 | * socket's write_space() callback, or if the |
1116 | * socket just returned a connection error, | ||
1117 | * then hold onto the transport lock. | ||
1118 | */ | ||
1119 | case -ECONNREFUSED: | ||
1120 | case -ENOTCONN: | ||
1121 | case -EHOSTDOWN: | ||
1122 | case -EHOSTUNREACH: | ||
1123 | case -ENETUNREACH: | ||
1124 | rpc_task_force_reencode(task); | ||
1125 | } | ||
1116 | } | 1126 | } |
1117 | 1127 | ||
1118 | /* | 1128 | /* |