[Devel] [PATCH RHEL7 COMMIT] ve/netns: wait for sub net namespaces to exit on ve cleanup

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 17 05:39:41 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.14
------>
commit da13b22809fc80f5493441b141f4979dedc74fb2
Author: Kirill Tkhai <ktkhai at odin.com>
Date:   Wed Jun 17 16:39:41 2015 +0400

    ve/netns: wait for sub net namespaces to exit on ve cleanup
    
    Porting patch diff-ve-net-netns-wait-for-sub-net-namespaces-to-exit-on-ve-cleanup
    from 2.6.32 (ve_netns mustn't die, earlier than child net):
    
    This is an alternative fix for PSBM-29810. Instead of messing with per
    ve netns lists, just take a reference to the ve->ve_netns per each sub
    net namespace.
    
    https://jira.sw.ru/browse/PSBM-31246
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    
    Acked-by: Andrew Vagin <avagin at parallels.com>
    Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
 net/core/net_namespace.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 3f7da6a..9e73cc4 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -165,6 +165,8 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
 
 #ifdef CONFIG_VE
 	net->owner_ve = get_ve(get_exec_env());
+	if (net->owner_ve->ve_netns)
+		get_net(net->owner_ve->ve_netns);
 #endif
 
 	atomic_set(&net->count, 1);
@@ -233,6 +235,7 @@ out_free:
 
 static void net_free(struct net *net)
 {
+	struct net *ve_netns = net->owner_ve->ve_netns;
 #ifdef NETNS_REFCNT_DEBUG
 	if (unlikely(atomic_read(&net->use_count) != 0)) {
 		pr_emerg("network namespace not free! Usage: %d\n",
@@ -242,6 +245,9 @@ static void net_free(struct net *net)
 #endif
 	kfree(net->gen);
 	kmem_cache_free(net_cachep, net);
+
+	if (ve_netns)
+		put_net(ve_netns);
 }
 
 void net_drop_ns(void *p)



More information about the Devel mailing list