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

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri May 15 18:28:30 MSK 2026



On 5/7/26 21:10, Vladimir Riabchun wrote:
> 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>
> ---
>  include/net/net_namespace.h | 2 --
>  net/core/net_namespace.c    | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
> index ed077747f710..11cad056f176 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 40e74d956bc2..bab48f8759f7 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -352,9 +352,7 @@ static __net_init int setup_net(struct net *net)
>  	LIST_HEAD(dev_kill_list);
>  	int error = 0;
>  
> -#ifdef CONFIG_VE
>  	net->owner_ve = get_ve(get_exec_env());
> -#endif
>  
>  	preempt_disable();
>  	net->net_cookie = gen_cookie_next(&net_cookie);
> @@ -507,7 +505,9 @@ static void inc_netns_avail(struct ve_struct *ve)
>  struct net *copy_net_ns(unsigned long flags,
>  			struct user_namespace *user_ns, struct net *old_net)
>  {
> +#ifdef CONFIG_VE
>  	struct ve_struct *ve = get_exec_env();
> +#endif

After commit a122689a3dbab ("ve/net: thread owning ve through copy_net_ns") we should probably just drop this hunk. As ve variable is now used to set ->owner_ve.

>  	struct ucounts *ucounts;
>  	struct net *net;
>  	int rv;

-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.



More information about the Devel mailing list