ipsec: Put dumpers on the dump list
Herbert Xu came up with the idea and the original patch to make xfrm_state dump list contain also dumpers: As it is we go to extraordinary lengths to ensure that states don't go away while dumpers go to sleep. It's much easier if we just put the dumpers themselves on the list since they can't go away while they're going. I've also changed the order of addition on new states to prevent a never-ending dump. Timo Teräs improved the patch to apply cleanly to latest tree, modified iteration code to be more readable by using a common struct for entries in the list, implemented the same idea for xfrm_policy dumping and moved the af_key specific "last" entry caching to af_key. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
b262e60309
commit
12a169e7d8
@@ -1102,7 +1102,7 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
|
||||
return xp;
|
||||
error:
|
||||
*errp = err;
|
||||
xp->dead = 1;
|
||||
xp->walk.dead = 1;
|
||||
xfrm_policy_destroy(xp);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1595,7 +1595,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
return -ENOENT;
|
||||
|
||||
read_lock(&xp->lock);
|
||||
if (xp->dead) {
|
||||
if (xp->walk.dead) {
|
||||
read_unlock(&xp->lock);
|
||||
goto out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user