From 3ef6e97d86cdec6cbd6059bc512a98802dfe2b73 Mon Sep 17 00:00:00 2001 From: Benjamin Thery Date: Mon, 19 Nov 2007 23:18:16 -0800 Subject: [PATCH] --- yaml --- r: 78171 b: refs/heads/master c: 3ef1355dcb8551730cc71e9ef4363f5c66ccad17 h: refs/heads/master i: 78169: 2a55620fb3b4d22a12a2825167851af8d7f3338b 78167: 68838af9d60bb246cd70eed5a6d6120669801866 v: v3 --- [refs] | 2 +- trunk/net/core/net_namespace.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 9a0aef840f81..dfb3c97c541b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 85b606800be20ceeca36bd8594c1eb228d2fb2f4 +refs/heads/master: 3ef1355dcb8551730cc71e9ef4363f5c66ccad17 diff --git a/trunk/net/core/net_namespace.c b/trunk/net/core/net_namespace.c index ec936ae92458..26e941d912e8 100644 --- a/trunk/net/core/net_namespace.c +++ b/trunk/net/core/net_namespace.c @@ -58,6 +58,7 @@ static __net_init int setup_net(struct net *net) #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);