Commit a7c44247 authored by Florian Westphal's avatar Florian Westphal Committed by Steffen Klassert

xfrm: policy: make xfrm_policy_lookup_bytype lockless

side effect: no longer disables BH (should be fine).
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent e37cc8ad
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
struct ctl_table_header; struct ctl_table_header;
struct xfrm_policy_hash { struct xfrm_policy_hash {
struct hlist_head *table; struct hlist_head __rcu *table;
unsigned int hmask; unsigned int hmask;
u8 dbits4; u8 dbits4;
u8 sbits4; u8 sbits4;
......
...@@ -1123,7 +1123,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type, ...@@ -1123,7 +1123,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
if (unlikely(!daddr || !saddr)) if (unlikely(!daddr || !saddr))
return NULL; return NULL;
read_lock_bh(&net->xfrm.xfrm_policy_lock); rcu_read_lock();
retry: retry:
do { do {
sequence = read_seqcount_begin(&xfrm_policy_hash_generation); sequence = read_seqcount_begin(&xfrm_policy_hash_generation);
...@@ -1172,7 +1172,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type, ...@@ -1172,7 +1172,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
if (ret && !xfrm_pol_hold_rcu(ret)) if (ret && !xfrm_pol_hold_rcu(ret))
goto retry; goto retry;
fail: fail:
read_unlock_bh(&net->xfrm.xfrm_policy_lock); rcu_read_unlock();
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment