[Devel] [PATCH RHEL7 COMMIT] ve/netns: Set null only for nets ve is a keeper of

Konstantin Khorenko khorenko at odin.com
Mon May 18 01:41:31 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.1
------>
commit fd28dbc730d49d4e141874d0d40c9bfedda1a6d5
Author: Cyrill Gorcunov <gorcunov at odin.com>
Date:   Mon May 18 12:41:31 2015 +0400

    ve/netns: Set null only for nets ve is a keeper of
    
    In venet we don't setup ve::ve_netns for nested net-namespaces
    but on net cleanups we zap them unconditionally which ruines
    further net unshares. Fix it testing if the @net we're cleaning
    up does belong us.
    
    https://jira.sw.ru/browse/PSBM-33480
    
    v2:
     - same applies when net namespace is created inside container
       itself: don't zap it until the net we're cleaning is the owner
    v3:
     - make it closer to pcs6 code
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at odin.com>
    Acked-by: Andrew Vagin <avagin at openvz.org>
---
 net/core/net_namespace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 409c31f..3886803 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -314,8 +314,10 @@ static void cleanup_net(struct work_struct *work)
 		ops_free_list(ops, &net_exit_list);
 
 	list_for_each_entry(net, &net_kill_list, cleanup_list) {
-		net->owner_ve->ve_netns = NULL;
-		put_ve(net->owner_ve);
+		struct ve_struct *ve = net->owner_ve;
+		if (ve->ve_netns == net)
+			ve->ve_netns = NULL;
+		put_ve(ve);
 	}
 
 	mutex_unlock(&net_mutex);



More information about the Devel mailing list