summaryrefslogtreecommitdiff
path: root/net/ipv4/raw.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2022-06-20 03:05:09 -0700
committerPaolo Abeni <pabeni@redhat.com>2022-06-21 11:38:29 +0200
commitaf185d8c76333daa877678e0166a7b45e63bf3c4 (patch)
tree0c3f2c0168c01595f1b17e34d9b4cd290a0e82c6 /net/ipv4/raw.c
parentf9aefd6b2aa38b9787d2705f0f1161dfd23cdb8f (diff)
raw: complete rcu conversion
raw_diag_dump() can use rcu_read_lock() instead of read_lock() Now the hashinfo lock is only used from process context, in write mode only, we can convert it to a spinlock, and we do not need to block BH anymore. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20220620100509.3493504-1-eric.dumazet@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r--net/ipv4/raw.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 959bea12dc48..027389969915 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -95,10 +95,10 @@ int raw_hash_sk(struct sock *sk)
hlist = &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)];
- write_lock_bh(&h->lock);
+ spin_lock(&h->lock);
__sk_nulls_add_node_rcu(sk, hlist);
sock_set_flag(sk, SOCK_RCU_FREE);
- write_unlock_bh(&h->lock);
+ spin_unlock(&h->lock);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
return 0;
@@ -109,10 +109,10 @@ void raw_unhash_sk(struct sock *sk)
{
struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;
- write_lock_bh(&h->lock);
+ spin_lock(&h->lock);
if (__sk_nulls_del_node_init_rcu(sk))
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
- write_unlock_bh(&h->lock);
+ spin_unlock(&h->lock);
}
EXPORT_SYMBOL_GPL(raw_unhash_sk);