[CRIU] [PATCH] cgroup: Skip unified hier controllers (v2)

Andrei Vagin avagin at virtuozzo.com
Sat Jul 8 02:03:38 MSK 2017


Applied, thanks
On Thu, Jun 29, 2017 at 01:24:55PM +0300, Pavel Emelyanov wrote:
> The unified hierarchy controller doesn't have any name, so criu hangs
> while parsing this sort of strings.
> 
> Let's skip those for now, until we implement cgroup2 support.
> 
> https://github.com/xemul/criu/issues/252
> 
> v2: Code comments
> 
> Reported-and-tested-by: Adrian Reber <adrian at lisas.de>
> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> ---
>  criu/proc_parse.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/proc_parse.c b/criu/proc_parse.c
> index b8881d2..4609633 100644
> --- a/criu/proc_parse.c
> +++ b/criu/proc_parse.c
> @@ -2335,8 +2335,19 @@ int parse_cgroup_file(FILE *f, struct list_head *retl, unsigned int *n)
>  		 * 2:name=systemd:/user.slice/user-1000.slice/session-1.scope
>  		 */
>  		name = strchr(buf, ':');
> -		if (name)
> +		if (name) {
>  			path = strchr(++name, ':');
> +			if (*name == ':') {
> +				/*
> +				 * It's unified hierarchy. On kernels with legacy
> +				 * tree this item is added automatically, so we
> +				 * can just skip one. For those with full unified
> +				 * support is on ... we need to write new code.
> +				 */
> +				xfree(ncc);
> +				continue;
> +			}
> +		}
>  		if (!name || !path) {
>  			pr_err("Failed parsing cgroup %s\n", buf);
>  			xfree(ncc);
> @@ -2500,6 +2511,13 @@ int collect_controllers(struct list_head *cgroups, unsigned int *n_cgroups)
>  		}
>  		controllers++;
>  
> +		if (*controllers == ':')
> +			/*
> +			 * Unified hier. See comment in parse_cgroup_file
> +			 * for more details.
> +			 */
> +			continue;
> +
>  		off = strchr(controllers, ':');
>  		if (!off) {
>  			pr_err("Unable to parse \"%s\"\n", buf);
> -- 
> 2.1.4
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list