[Devel] [VZ10 v2 01/21] ve/net: Have net->owner_ve when !CONFIG_VE

Vladimir Riabchun vladimir.riabchun at virtuozzo.com
Fri May 15 23:01:41 MSK 2026


There is a big number of net->owner_ve, that are not covered by
ifdef guard, so it is actually easier to have this field
when !CONFIG_VE and store NULL there.

Also, fix unused variable in copy_net_ns while there.

https://virtuozzo.atlassian.net/browse/VSTOR-130116

Feature: !CONFIG_VE build
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
---
v1 -> v2:
 - Drop setup_net hunk
 - Adjust copy_net_ns hunk

 include/net/net_namespace.h | 2 --
 net/core/net_namespace.c    | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index dd0edb96f0ee..5cf615b03da0 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -120,9 +120,7 @@ struct net {
 
 	struct net_device       *loopback_dev;          /* The loopback */
 
-#ifdef CONFIG_VE
 	struct ve_struct	*owner_ve;
-#endif
 
 	/* core fib_rules */
 	struct list_head	rules_ops;
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 3738e5274cd9..a4d91cccaaa4 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -501,7 +501,9 @@ struct net *copy_net_ns(unsigned long flags,
 			struct user_namespace *user_ns, struct net *old_net,
 			struct ve_struct *new_ve)
 {
+#ifdef CONFIG_VE
 	struct ve_struct *ve;
+#endif
 	struct ucounts *ucounts;
 	struct net *net;
 	int rv;
@@ -509,6 +511,7 @@ struct net *copy_net_ns(unsigned long flags,
 	if (!(flags & CLONE_NEWNET))
 		return get_net(old_net);
 
+#ifdef CONFIG_VE
 	/*
 	 * The ve that should own the new netns. When called from
 	 * copy_namespaces()/unshare_nsproxy_namespaces() with a freshly
@@ -516,6 +519,7 @@ struct net *copy_net_ns(unsigned long flags,
 	 * caller because get_exec_env() still resolves to the parent ve.
 	 */
 	ve = new_ve ?: get_exec_env();
+#endif
 
 	ucounts = inc_net_namespaces(user_ns);
 	if (!ucounts)
-- 
2.43.0



More information about the Devel mailing list