diff options
author | David Howells <dhowells@redhat.com> | 2017-09-04 10:28:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-05 17:39:17 -0400 |
commit | fdade4f69e4ca29753963f858dc42c5f8faf1d0b (patch) | |
tree | 2747b8d05e5dfb48bb9ed17eeab124b835797388 | |
parent | 5e369aefdce4818c8264b81d3436eccf35af561e (diff) |
rxrpc: Make service connection lookup always check for retry
When an RxRPC service packet comes in, the target connection is looked up
by an rb-tree search under RCU and a read-locked seqlock; the seqlock retry
check is, however, currently skipped if we got a match, but probably
shouldn't be in case the connection we found gets replaced whilst we're
doing a search.
Make the lookup procedure always go through need_seqretry(), even if the
lookup was successful. This makes sure we always pick up on a write-lock
event.
On the other hand, since we don't take a ref on the object, but rely on RCU
to prevent its destruction after dropping the seqlock, I'm not sure this is
necessary.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/rxrpc/conn_service.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/rxrpc/conn_service.c b/net/rxrpc/conn_service.c index e60fcd2a4a02..f6fcdb3130a1 100644 --- a/net/rxrpc/conn_service.c +++ b/net/rxrpc/conn_service.c | |||
@@ -50,12 +50,11 @@ struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *peer, | |||
50 | else if (conn->proto.index_key > k.index_key) | 50 | else if (conn->proto.index_key > k.index_key) |
51 | p = rcu_dereference_raw(p->rb_right); | 51 | p = rcu_dereference_raw(p->rb_right); |
52 | else | 52 | else |
53 | goto done; | 53 | break; |
54 | conn = NULL; | 54 | conn = NULL; |
55 | } | 55 | } |
56 | } while (need_seqretry(&peer->service_conn_lock, seq)); | 56 | } while (need_seqretry(&peer->service_conn_lock, seq)); |
57 | 57 | ||
58 | done: | ||
59 | done_seqretry(&peer->service_conn_lock, seq); | 58 | done_seqretry(&peer->service_conn_lock, seq); |
60 | _leave(" = %d", conn ? conn->debug_id : -1); | 59 | _leave(" = %d", conn ? conn->debug_id : -1); |
61 | return conn; | 60 | return conn; |