aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Thery <benjamin.thery@bull.net>2007-11-20 02:18:16 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:35 -0500
commit3ef1355dcb8551730cc71e9ef4363f5c66ccad17 (patch)
treecd17815dd88eb923b480547efe862ed2ce5f0290
parent85b606800be20ceeca36bd8594c1eb228d2fb2f4 (diff)
[NET]: Make netns cleanup to run in a separate queue
This patch adds a separate workqueue for cleaning up a network namespace. If we use the keventd workqueue to execute cleanup_net(), there is a problem to unregister devices in IPv6. Indeed the code that cleans up also schedule work in keventd: as long as cleanup_net() hasn't return, dst_gc_task() cannot run and as long as dst_gc_task() has not run, there are still some references pending on the net devices and cleanup_net() can not unregister and exit the keventd workqueue. Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Acked-by: Denis V. Lunev <den@openvz.org> Acked-By: Kirill Korotaev <dev@sw.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/net_namespace.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index ec936ae92458..26e941d912e8 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -58,6 +58,7 @@ out_undo:
58 58
59#ifdef CONFIG_NET_NS 59#ifdef CONFIG_NET_NS
60static struct kmem_cache *net_cachep; 60static struct kmem_cache *net_cachep;
61static struct workqueue_struct *netns_wq;
61 62
62static struct net *net_alloc(void) 63static struct net *net_alloc(void)
63{ 64{
@@ -149,7 +150,7 @@ void __put_net(struct net *net)
149{ 150{
150 /* Cleanup the network namespace in process context */ 151 /* Cleanup the network namespace in process context */
151 INIT_WORK(&net->work, cleanup_net); 152 INIT_WORK(&net->work, cleanup_net);
152 schedule_work(&net->work); 153 queue_work(netns_wq, &net->work);
153} 154}
154EXPORT_SYMBOL_GPL(__put_net); 155EXPORT_SYMBOL_GPL(__put_net);
155 156
@@ -171,7 +172,13 @@ static int __init net_ns_init(void)
171 net_cachep = kmem_cache_create("net_namespace", sizeof(struct net), 172 net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
172 SMP_CACHE_BYTES, 173 SMP_CACHE_BYTES,
173 SLAB_PANIC, NULL); 174 SLAB_PANIC, NULL);
175
176 /* Create workqueue for cleanup */
177 netns_wq = create_singlethread_workqueue("netns");
178 if (!netns_wq)
179 panic("Could not create netns workq");
174#endif 180#endif
181
175 mutex_lock(&net_mutex); 182 mutex_lock(&net_mutex);
176 err = setup_net(&init_net); 183 err = setup_net(&init_net);
177 184