diff options
| author | Eric Dumazet <[email protected]> | 2022-06-20 10:05:09 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2022-06-21 09:38:29 +0000 |
| commit | af185d8c76333daa877678e0166a7b45e63bf3c4 (patch) | |
| tree | 0c3f2c0168c01595f1b17e34d9b4cd290a0e82c6 /net/ipv4/raw.c | |
| parent | net: warn if mac header was not set (diff) | |
| download | kernel-af185d8c76333daa877678e0166a7b45e63bf3c4.tar.gz kernel-af185d8c76333daa877678e0166a7b45e63bf3c4.zip | |
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/ipv4/raw.c')
| -rw-r--r-- | net/ipv4/raw.c | 8 |
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); |
