Skip to content

Commit

Permalink
xfrm: policy: make xfrm_policy_lookup_bytype lockless
Browse files Browse the repository at this point in the history
side effect: no longer disables BH (should be fine).

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Florian Westphal authored and Steffen Klassert committed Aug 12, 2016
1 parent e37cc8a commit a7c4424
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/net/netns/xfrm.h
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
struct ctl_table_header;

struct xfrm_policy_hash {
struct hlist_head *table;
struct hlist_head __rcu *table;
unsigned int hmask;
u8 dbits4;
u8 sbits4;
4 changes: 2 additions & 2 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
@@ -1123,7 +1123,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
if (unlikely(!daddr || !saddr))
return NULL;

read_lock_bh(&net->xfrm.xfrm_policy_lock);
rcu_read_lock();
retry:
do {
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,
if (ret && !xfrm_pol_hold_rcu(ret))
goto retry;
fail:
read_unlock_bh(&net->xfrm.xfrm_policy_lock);
rcu_read_unlock();

return ret;
}

0 comments on commit a7c4424

Please sign in to comment.