diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-08-24 06:30:28 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:08:46 -0400 |
commit | 1c0953997567b22e32fdf85d3b4bc0f2461fd161 (patch) | |
tree | 5e4d691503d911f2134734e345ae0d7f01b97e4e /net/xfrm | |
parent | c7f5ea3a4d1ae6b3b426e113358fdc57494bc754 (diff) |
[XFRM]: Purge dst references to deleted SAs passively.
Just let GC and other normal mechanisms take care of getting
rid of DST cache references to deleted xfrm_state objects
instead of walking all the policy bundles.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 17 |
2 files changed, 1 insertions, 18 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index cfa5c692f2e8..1bcaae4adf3a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1472,7 +1472,7 @@ static void __xfrm_garbage_collect(void) | |||
1472 | xfrm_prune_bundles(unused_bundle); | 1472 | xfrm_prune_bundles(unused_bundle); |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | int xfrm_flush_bundles(void) | 1475 | static int xfrm_flush_bundles(void) |
1476 | { | 1476 | { |
1477 | xfrm_prune_bundles(stale_bundle); | 1477 | xfrm_prune_bundles(stale_bundle); |
1478 | return 0; | 1478 | return 0; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 77ef796c9d0d..9ff00b7d6ad3 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -256,8 +256,6 @@ static struct work_struct xfrm_state_gc_work; | |||
256 | static HLIST_HEAD(xfrm_state_gc_list); | 256 | static HLIST_HEAD(xfrm_state_gc_list); |
257 | static DEFINE_SPINLOCK(xfrm_state_gc_lock); | 257 | static DEFINE_SPINLOCK(xfrm_state_gc_lock); |
258 | 258 | ||
259 | static int xfrm_state_gc_flush_bundles; | ||
260 | |||
261 | int __xfrm_state_delete(struct xfrm_state *x); | 259 | int __xfrm_state_delete(struct xfrm_state *x); |
262 | 260 | ||
263 | static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family); | 261 | static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family); |
@@ -293,11 +291,6 @@ static void xfrm_state_gc_task(void *data) | |||
293 | struct hlist_node *entry, *tmp; | 291 | struct hlist_node *entry, *tmp; |
294 | struct hlist_head gc_list; | 292 | struct hlist_head gc_list; |
295 | 293 | ||
296 | if (xfrm_state_gc_flush_bundles) { | ||
297 | xfrm_state_gc_flush_bundles = 0; | ||
298 | xfrm_flush_bundles(); | ||
299 | } | ||
300 | |||
301 | spin_lock_bh(&xfrm_state_gc_lock); | 294 | spin_lock_bh(&xfrm_state_gc_lock); |
302 | gc_list.first = xfrm_state_gc_list.first; | 295 | gc_list.first = xfrm_state_gc_list.first; |
303 | INIT_HLIST_HEAD(&xfrm_state_gc_list); | 296 | INIT_HLIST_HEAD(&xfrm_state_gc_list); |
@@ -454,16 +447,6 @@ int __xfrm_state_delete(struct xfrm_state *x) | |||
454 | if (del_timer(&x->rtimer)) | 447 | if (del_timer(&x->rtimer)) |
455 | __xfrm_state_put(x); | 448 | __xfrm_state_put(x); |
456 | 449 | ||
457 | /* The number two in this test is the reference | ||
458 | * mentioned in the comment below plus the reference | ||
459 | * our caller holds. A larger value means that | ||
460 | * there are DSTs attached to this xfrm_state. | ||
461 | */ | ||
462 | if (atomic_read(&x->refcnt) > 2) { | ||
463 | xfrm_state_gc_flush_bundles = 1; | ||
464 | schedule_work(&xfrm_state_gc_work); | ||
465 | } | ||
466 | |||
467 | /* All xfrm_state objects are created by xfrm_state_alloc. | 450 | /* All xfrm_state objects are created by xfrm_state_alloc. |
468 | * The xfrm_state_alloc call gives a reference, and that | 451 | * The xfrm_state_alloc call gives a reference, and that |
469 | * is what we are dropping here. | 452 | * is what we are dropping here. |