]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: Make netns cleanup to run in a separate queue
authorBenjamin Thery <benjamin.thery@bull.net>
Tue, 20 Nov 2007 07:18:16 +0000 (23:18 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:54:35 +0000 (14:54 -0800)
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>
net/core/net_namespace.c

index ec936ae92458fb6325b33495b09216bb5fc09831..26e941d912e8e68dd1e308e705fec2bbd92d37fc 100644 (file)
@@ -58,6 +58,7 @@ out_undo:
 
 #ifdef CONFIG_NET_NS
 static struct kmem_cache *net_cachep;
+static struct workqueue_struct *netns_wq;
 
 static struct net *net_alloc(void)
 {
@@ -149,7 +150,7 @@ void __put_net(struct net *net)
 {
        /* Cleanup the network namespace in process context */
        INIT_WORK(&net->work, cleanup_net);
-       schedule_work(&net->work);
+       queue_work(netns_wq, &net->work);
 }
 EXPORT_SYMBOL_GPL(__put_net);
 
@@ -171,7 +172,13 @@ static int __init net_ns_init(void)
        net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
                                        SMP_CACHE_BYTES,
                                        SLAB_PANIC, NULL);
+
+       /* Create workqueue for cleanup */
+       netns_wq = create_singlethread_workqueue("netns");
+       if (!netns_wq)
+               panic("Could not create netns workq");
 #endif
+
        mutex_lock(&net_mutex);
        err = setup_net(&init_net);