summaryrefslogtreecommitdiffstats
path: root/net/rxrpc/call_state.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2022-12-19 16:32:32 +0100
committerDavid Howells <dhowells@redhat.com>2023-01-06 10:43:32 +0100
commitd41b3f5b96881809c73f86e3ca436c9426610b7a (patch)
treece6a8bce0d039874a7d221def72b35e7f9ec4d12 /net/rxrpc/call_state.c
parentrxrpc: Split out the call state changing functions into their own file (diff)
downloadlinux-d41b3f5b96881809c73f86e3ca436c9426610b7a.tar.xz
linux-d41b3f5b96881809c73f86e3ca436c9426610b7a.zip
rxrpc: Wrap accesses to get call state to put the barrier in one place
Wrap accesses to get the state of a call from outside of the I/O thread in a single place so that the barrier needed to order wrt the error code and abort code is in just that place. Also use a barrier when setting the call state and again when reading the call state such that the auxiliary completion info (error code, abort code) can be read without taking a read lock on the call state lock. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org
Diffstat (limited to 'net/rxrpc/call_state.c')
-rw-r--r--net/rxrpc/call_state.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/rxrpc/call_state.c b/net/rxrpc/call_state.c
index 8fbb2112ed7e..649fb9e5d1af 100644
--- a/net/rxrpc/call_state.c
+++ b/net/rxrpc/call_state.c
@@ -19,7 +19,8 @@ bool __rxrpc_set_call_completion(struct rxrpc_call *call,
call->abort_code = abort_code;
call->error = error;
call->completion = compl;
- call->state = RXRPC_CALL_COMPLETE;
+ /* Allow reader of completion state to operate locklessly */
+ smp_store_release(&call->state, RXRPC_CALL_COMPLETE);
trace_rxrpc_call_complete(call);
wake_up(&call->waitq);
rxrpc_notify_socket(call);