diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:20:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:20:36 -0500 |
commit | c78371441c0d957f54c9f8a35b3ee5a378d14808 (patch) | |
tree | 660b55bc3d85aa04a72bbff6c7d357f82dc5494d /net/xfrm | |
parent | b8a0ae20b0eecd4b86a113d2abe2fa5a582b30a6 (diff) |
netns xfrm: per-netns state GC work
State GC is per-netns, and this is part of it.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_state.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 864a97477ae5..69c0b06bf756 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -176,7 +176,6 @@ EXPORT_SYMBOL(km_waitq); | |||
176 | static DEFINE_RWLOCK(xfrm_state_afinfo_lock); | 176 | static DEFINE_RWLOCK(xfrm_state_afinfo_lock); |
177 | static struct xfrm_state_afinfo *xfrm_state_afinfo[NPROTO]; | 177 | static struct xfrm_state_afinfo *xfrm_state_afinfo[NPROTO]; |
178 | 178 | ||
179 | static struct work_struct xfrm_state_gc_work; | ||
180 | static DEFINE_SPINLOCK(xfrm_state_gc_lock); | 179 | static DEFINE_SPINLOCK(xfrm_state_gc_lock); |
181 | 180 | ||
182 | int __xfrm_state_delete(struct xfrm_state *x); | 181 | int __xfrm_state_delete(struct xfrm_state *x); |
@@ -386,14 +385,15 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x) | |||
386 | kfree(x); | 385 | kfree(x); |
387 | } | 386 | } |
388 | 387 | ||
389 | static void xfrm_state_gc_task(struct work_struct *data) | 388 | static void xfrm_state_gc_task(struct work_struct *work) |
390 | { | 389 | { |
390 | struct net *net = container_of(work, struct net, xfrm.state_gc_work); | ||
391 | struct xfrm_state *x; | 391 | struct xfrm_state *x; |
392 | struct hlist_node *entry, *tmp; | 392 | struct hlist_node *entry, *tmp; |
393 | struct hlist_head gc_list; | 393 | struct hlist_head gc_list; |
394 | 394 | ||
395 | spin_lock_bh(&xfrm_state_gc_lock); | 395 | spin_lock_bh(&xfrm_state_gc_lock); |
396 | hlist_move_list(&init_net.xfrm.state_gc_list, &gc_list); | 396 | hlist_move_list(&net->xfrm.state_gc_list, &gc_list); |
397 | spin_unlock_bh(&xfrm_state_gc_lock); | 397 | spin_unlock_bh(&xfrm_state_gc_lock); |
398 | 398 | ||
399 | hlist_for_each_entry_safe(x, entry, tmp, &gc_list, gclist) | 399 | hlist_for_each_entry_safe(x, entry, tmp, &gc_list, gclist) |
@@ -528,7 +528,7 @@ void __xfrm_state_destroy(struct xfrm_state *x) | |||
528 | spin_lock_bh(&xfrm_state_gc_lock); | 528 | spin_lock_bh(&xfrm_state_gc_lock); |
529 | hlist_add_head(&x->gclist, &init_net.xfrm.state_gc_list); | 529 | hlist_add_head(&x->gclist, &init_net.xfrm.state_gc_list); |
530 | spin_unlock_bh(&xfrm_state_gc_lock); | 530 | spin_unlock_bh(&xfrm_state_gc_lock); |
531 | schedule_work(&xfrm_state_gc_work); | 531 | schedule_work(&init_net.xfrm.state_gc_work); |
532 | } | 532 | } |
533 | EXPORT_SYMBOL(__xfrm_state_destroy); | 533 | EXPORT_SYMBOL(__xfrm_state_destroy); |
534 | 534 | ||
@@ -2088,7 +2088,7 @@ int __net_init xfrm_state_init(struct net *net) | |||
2088 | net->xfrm.state_num = 0; | 2088 | net->xfrm.state_num = 0; |
2089 | INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); | 2089 | INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); |
2090 | INIT_HLIST_HEAD(&net->xfrm.state_gc_list); | 2090 | INIT_HLIST_HEAD(&net->xfrm.state_gc_list); |
2091 | INIT_WORK(&xfrm_state_gc_work, xfrm_state_gc_task); | 2091 | INIT_WORK(&net->xfrm.state_gc_work, xfrm_state_gc_task); |
2092 | return 0; | 2092 | return 0; |
2093 | 2093 | ||
2094 | out_byspi: | 2094 | out_byspi: |