Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193989
b: refs/heads/master
c: 285ead1
h: refs/heads/master
i:
  193987: bc845a1
v: v3
  • Loading branch information
Timo Teräs authored and David S. Miller committed Apr 7, 2010
1 parent f0ddf90 commit fcd0eff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80c802f3073e84c956846e921e8a0b02dfa3755f
refs/heads/master: 285ead175c5dd5075cab5b6c94f35a3e6c0a3ae6
39 changes: 5 additions & 34 deletions trunk/net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ static struct xfrm_policy_afinfo *xfrm_policy_afinfo[NPROTO];

static struct kmem_cache *xfrm_dst_cache __read_mostly;

static HLIST_HEAD(xfrm_policy_gc_list);
static DEFINE_SPINLOCK(xfrm_policy_gc_lock);

static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
static void xfrm_init_pmtu(struct dst_entry *dst);
Expand Down Expand Up @@ -288,32 +285,6 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
}
EXPORT_SYMBOL(xfrm_policy_destroy);

static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
{
atomic_inc(&policy->genid);

if (del_timer(&policy->timer))
atomic_dec(&policy->refcnt);

xfrm_pol_put(policy);
}

static void xfrm_policy_gc_task(struct work_struct *work)
{
struct xfrm_policy *policy;
struct hlist_node *entry, *tmp;
struct hlist_head gc_list;

spin_lock_bh(&xfrm_policy_gc_lock);
gc_list.first = xfrm_policy_gc_list.first;
INIT_HLIST_HEAD(&xfrm_policy_gc_list);
spin_unlock_bh(&xfrm_policy_gc_lock);

hlist_for_each_entry_safe(policy, entry, tmp, &gc_list, bydst)
xfrm_policy_gc_kill(policy);
}
static DECLARE_WORK(xfrm_policy_gc_work, xfrm_policy_gc_task);

/* Rule must be locked. Release descentant resources, announce
* entry dead. The rule must be unlinked from lists to the moment.
*/
Expand All @@ -322,11 +293,12 @@ static void xfrm_policy_kill(struct xfrm_policy *policy)
{
policy->walk.dead = 1;

spin_lock_bh(&xfrm_policy_gc_lock);
hlist_add_head(&policy->bydst, &xfrm_policy_gc_list);
spin_unlock_bh(&xfrm_policy_gc_lock);
atomic_inc(&policy->genid);

schedule_work(&xfrm_policy_gc_work);
if (del_timer(&policy->timer))
xfrm_pol_put(policy);

xfrm_pol_put(policy);
}

static unsigned int xfrm_policy_hashmax __read_mostly = 1 * 1024 * 1024;
Expand Down Expand Up @@ -2599,7 +2571,6 @@ static void xfrm_policy_fini(struct net *net)
audit_info.sessionid = -1;
audit_info.secid = 0;
xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info);
flush_work(&xfrm_policy_gc_work);

WARN_ON(!list_empty(&net->xfrm.policy_all));

Expand Down

0 comments on commit fcd0eff

Please sign in to comment.