[Devel] [PATCH vz10] ve: fix envID showing "/" instead of "0" for host ve0

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Mon Jun 1 13:56:51 MSK 2026


Looks good. Please double-check that it also fixes the name printing in /proc/vz/veinfo (requires modprobe vzmon)

On 5/24/26 22:32, Eva Kurchatova wrote:
> ve0 is statically initialized with .ve_name = "0", but ve_online()
> unconditionally overwrites it with cgroup name, which returns "/"
> for the root cgroup.
> 
> In the vz7 kernel this didn't happen because ve_create() had an early
> `goto do_init` for the root cgroup that skipped the name assignment
> entirely, preserving the static "0". The current kernel's split into
> css_alloc/css_online lost that guard.
> 
> Skip ve_name assignment in ve_online() for ve0, and correspondingly
> skip kfree() on the static string in ve_offline().
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

> 
> https://virtuozzo.atlassian.net/browse/VSTOR-131944
> Feature: ve: ve generic structures
> ---
>  kernel/ve/ve.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
> index 106fc225c60d..97442585d7bc 100644
> --- a/kernel/ve/ve.c
> +++ b/kernel/ve/ve.c
> @@ -1040,6 +1040,10 @@ static int ve_online(struct cgroup_subsys_state *css)
>  	static DEFINE_MUTEX(ve_name_mutex);
>  	struct ve_struct *ve = css_to_ve(css);
>  
> +	/* ve0 has a statically initialized ve_name; skip overwriting it */
> +	if (ve_is_super(ve))
> +		return 0;
> +
>  	mutex_lock(&ve_name_mutex);
>  	/*
>  	 * Cache ve_name to have it directly accessed. But keep in mind,
> @@ -1060,8 +1064,10 @@ static void ve_offline(struct cgroup_subsys_state *css)
>  {
>  	struct ve_struct *ve = css_to_ve(css);
>  
> -	kfree(ve->ve_name);
> -	ve->ve_name = NULL;
> +	if (!ve_is_super(ve)) {
> +		kfree(ve->ve_name);
> +		ve->ve_name = NULL;
> +	}
>  
>  	ve_cleanup_ra_data(ve, NULL);
>  }

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



More information about the Devel mailing list