[Devel] [PATCH VZ10] ve/mntns: make mnt_namespace->ve_owner present in not CONFIG_VE case

Vasileios Almpanis vasileios.almpanis at virtuozzo.com
Fri May 15 14:37:36 MSK 2026


Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>

On 5/15/26 1:31 PM, Pavel Tikhomirov wrote:
> We already have mount->ve_owner present if CONFIG_VE is disabled and
> since mnt_namespace->ve_owner is used when setting mount->ve_owner it
> would be cleaner to also have it.
>
> It both fixes the commit adding mnt_namespace->ve_owner and the one
> after that which starts to use it for setting owner for mounts.
>
> While on it put_ve(ve) already checks ve for NULL, so we can drop
> excess pre-check in free_mnt_ns().
>
> https://virtuozzo.atlassian.net/browse/VSTOR-129744
> Fixes: f07a52b3f1959 ("ve/mntns: add ve_owner to struct mnt_namespace")
> Fixes: 7428384902250 ("ve/mount: thread owning ve through alloc_vfsmnt/clone_mnt/copy_tree")
> Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
> ---
>   fs/mount.h     |  2 --
>   fs/namespace.c | 11 +----------
>   2 files changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/fs/mount.h b/fs/mount.h
> index aea2dc4c082be..5cf06431d5868 100644
> --- a/fs/mount.h
> +++ b/fs/mount.h
> @@ -20,9 +20,7 @@ struct mnt_namespace {
>   	struct rb_node		mnt_ns_tree_node; /* node in the mnt_ns_tree */
>   	refcount_t		passive; /* number references not pinning @mounts */
>   	struct list_head	mntns_list;
> -#ifdef CONFIG_VE
>   	struct ve_struct	*ve_owner;
> -#endif
>   } __randomize_layout;
>   
>   struct mnt_pcp {
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 865635366fd7e..acd4507e12472 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -4147,10 +4147,7 @@ static void free_mnt_ns(struct mnt_namespace *ns)
>   	list_del(&ns->mntns_list);
>   	spin_unlock(&all_mntns_list_lock);
>   
> -#ifdef CONFIG_VE
> -	if (ns->ve_owner)
> -		put_ve(ns->ve_owner);
> -#endif
> +	put_ve(ns->ve_owner);
>   
>   	mnt_ns_tree_remove(ns);
>   }
> @@ -4204,9 +4201,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns,
>   	init_waitqueue_head(&new_ns->poll);
>   	new_ns->user_ns = get_user_ns(user_ns);
>   	new_ns->ucounts = ucounts;
> -#ifdef CONFIG_VE
>   	new_ns->ve_owner = get_ve(new_ve ?: get_exec_env());
> -#endif
>   	return new_ns;
>   }
>   
> @@ -4241,11 +4236,7 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
>   	copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;
>   	if (user_ns != ns->user_ns)
>   		copy_flags |= CL_SHARED_TO_SLAVE;
> -#ifdef CONFIG_VE
>   	new = copy_tree(old, old->mnt.mnt_root, copy_flags, new_ns->ve_owner);
> -#else
> -	new = copy_tree(old, old->mnt.mnt_root, copy_flags, NULL);
> -#endif
>   	if (IS_ERR(new)) {
>   		namespace_unlock();
>   		ns_free_inum(&new_ns->ns);

-- 
Best regards, Vasileios Almpanis
Software Developer, Virtuozzo.



More information about the Devel mailing list