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

xfrm: policy: use rcu versions for iteration and list add/del

This is required once we allow lockless readers.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent d737a580
...@@ -426,14 +426,14 @@ static void xfrm_dst_hash_transfer(struct net *net, ...@@ -426,14 +426,14 @@ static void xfrm_dst_hash_transfer(struct net *net,
h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr, h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr,
pol->family, nhashmask, dbits, sbits); pol->family, nhashmask, dbits, sbits);
if (!entry0) { if (!entry0) {
hlist_del(&pol->bydst); hlist_del_rcu(&pol->bydst);
hlist_add_head(&pol->bydst, ndsttable+h); hlist_add_head_rcu(&pol->bydst, ndsttable + h);
h0 = h; h0 = h;
} else { } else {
if (h != h0) if (h != h0)
continue; continue;
hlist_del(&pol->bydst); hlist_del_rcu(&pol->bydst);
hlist_add_behind(&pol->bydst, entry0); hlist_add_behind_rcu(&pol->bydst, entry0);
} }
entry0 = &pol->bydst; entry0 = &pol->bydst;
} }
...@@ -1106,7 +1106,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type, ...@@ -1106,7 +1106,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
read_lock_bh(&net->xfrm.xfrm_policy_lock); read_lock_bh(&net->xfrm.xfrm_policy_lock);
chain = policy_hash_direct(net, daddr, saddr, family, dir); chain = policy_hash_direct(net, daddr, saddr, family, dir);
ret = NULL; ret = NULL;
hlist_for_each_entry(pol, chain, bydst) { hlist_for_each_entry_rcu(pol, chain, bydst) {
err = xfrm_policy_match(pol, fl, type, family, dir); err = xfrm_policy_match(pol, fl, type, family, dir);
if (err) { if (err) {
if (err == -ESRCH) if (err == -ESRCH)
...@@ -1122,7 +1122,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type, ...@@ -1122,7 +1122,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
} }
} }
chain = &net->xfrm.policy_inexact[dir]; chain = &net->xfrm.policy_inexact[dir];
hlist_for_each_entry(pol, chain, bydst) { hlist_for_each_entry_rcu(pol, chain, bydst) {
if ((pol->priority >= priority) && ret) if ((pol->priority >= priority) && ret)
break; break;
...@@ -1271,7 +1271,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, ...@@ -1271,7 +1271,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
/* Socket policies are not hashed. */ /* Socket policies are not hashed. */
if (!hlist_unhashed(&pol->bydst)) { if (!hlist_unhashed(&pol->bydst)) {
hlist_del(&pol->bydst); hlist_del_rcu(&pol->bydst);
hlist_del(&pol->byidx); hlist_del(&pol->byidx);
} }
......
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