diff options
author | David Howells <dhowells@redhat.com> | 2018-10-08 10:46:05 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-10-08 10:57:36 -0400 |
commit | dfe995224693798e554ab4770f6d8a096afc60cd (patch) | |
tree | 313fe6d97876e597ce8b03f04bcb1016cee54b62 /net/rxrpc | |
parent | c479d5f2c2e1ce609da08c075054440d97ddff52 (diff) |
rxrpc: Carry call state out of locked section in rxrpc_rotate_tx_window()
Carry the call state out of the locked section in rxrpc_rotate_tx_window()
rather than sampling it afterwards. This is only used to select tracepoint
data, but could have changed by the time we do the tracepoint.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/input.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 8834aa627371..af8ce64f4162 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c | |||
@@ -278,23 +278,26 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to, | |||
278 | static bool rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun, | 278 | static bool rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun, |
279 | const char *abort_why) | 279 | const char *abort_why) |
280 | { | 280 | { |
281 | unsigned int state; | ||
281 | 282 | ||
282 | ASSERT(test_bit(RXRPC_CALL_TX_LAST, &call->flags)); | 283 | ASSERT(test_bit(RXRPC_CALL_TX_LAST, &call->flags)); |
283 | 284 | ||
284 | write_lock(&call->state_lock); | 285 | write_lock(&call->state_lock); |
285 | 286 | ||
286 | switch (call->state) { | 287 | state = call->state; |
288 | switch (state) { | ||
287 | case RXRPC_CALL_CLIENT_SEND_REQUEST: | 289 | case RXRPC_CALL_CLIENT_SEND_REQUEST: |
288 | case RXRPC_CALL_CLIENT_AWAIT_REPLY: | 290 | case RXRPC_CALL_CLIENT_AWAIT_REPLY: |
289 | if (reply_begun) | 291 | if (reply_begun) |
290 | call->state = RXRPC_CALL_CLIENT_RECV_REPLY; | 292 | call->state = state = RXRPC_CALL_CLIENT_RECV_REPLY; |
291 | else | 293 | else |
292 | call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY; | 294 | call->state = state = RXRPC_CALL_CLIENT_AWAIT_REPLY; |
293 | break; | 295 | break; |
294 | 296 | ||
295 | case RXRPC_CALL_SERVER_AWAIT_ACK: | 297 | case RXRPC_CALL_SERVER_AWAIT_ACK: |
296 | __rxrpc_call_completed(call); | 298 | __rxrpc_call_completed(call); |
297 | rxrpc_notify_socket(call); | 299 | rxrpc_notify_socket(call); |
300 | state = call->state; | ||
298 | break; | 301 | break; |
299 | 302 | ||
300 | default: | 303 | default: |
@@ -302,11 +305,10 @@ static bool rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun, | |||
302 | } | 305 | } |
303 | 306 | ||
304 | write_unlock(&call->state_lock); | 307 | write_unlock(&call->state_lock); |
305 | if (call->state == RXRPC_CALL_CLIENT_AWAIT_REPLY) { | 308 | if (state == RXRPC_CALL_CLIENT_AWAIT_REPLY) |
306 | trace_rxrpc_transmit(call, rxrpc_transmit_await_reply); | 309 | trace_rxrpc_transmit(call, rxrpc_transmit_await_reply); |
307 | } else { | 310 | else |
308 | trace_rxrpc_transmit(call, rxrpc_transmit_end); | 311 | trace_rxrpc_transmit(call, rxrpc_transmit_end); |
309 | } | ||
310 | _leave(" = ok"); | 312 | _leave(" = ok"); |
311 | return true; | 313 | return true; |
312 | 314 | ||