cgroup: Skip unified hier controllers

Submitted by Pavel Emelianov on June 23, 2017, 11:13 a.m.

Details

Message ID 02440237-88ed-67de-1410-c1635550180a@virtuozzo.com
State New
Series "cgroup: Skip unified hier controllers"
Headers show

Commit Message

Pavel Emelianov June 23, 2017, 11:13 a.m.
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

Reported-and-tested-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>

---



-- Pavel

Patch hide | download patch | download mbox

diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index f1237cf9..708f41c6 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -2272,8 +2272,13 @@  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 == ':') { /* unified hier */
+				xfree(ncc);
+				continue;
+			}
+		}
 		if (!name || !path) {
 			pr_err("Failed parsing cgroup %s\n", buf);
 			xfree(ncc);
@@ -2437,6 +2442,9 @@  int collect_controllers(struct list_head *cgroups, unsigned int *n_cgroups)
 		}
 		controllers++;
 
+		if (*controllers == ':') /* unified hier */
+			continue;
+
 		off = strchr(controllers, ':');
 		if (!off) {
 			pr_err("Unable to parse \"%s\"\n", buf);

Comments

Andrey Vagin June 27, 2017, 6:49 p.m.
On Fri, Jun 23, 2017 at 02:13:12PM +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
> 
> Reported-and-tested-by: Adrian Reber <adrian@lisas.de>
> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
> 
> ---
> 
> diff --git a/criu/proc_parse.c b/criu/proc_parse.c
> index f1237cf9..708f41c6 100644
> --- a/criu/proc_parse.c
> +++ b/criu/proc_parse.c
> @@ -2272,8 +2272,13 @@ 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 == ':') { /* unified hier */

Could you write a comment here, why we skip them?

> +				xfree(ncc);
> +				continue;
> +			}
> +		}
>  		if (!name || !path) {
>  			pr_err("Failed parsing cgroup %s\n", buf);
>  			xfree(ncc);
> @@ -2437,6 +2442,9 @@ int collect_controllers(struct list_head *cgroups, unsigned int *n_cgroups)
>  		}
>  		controllers++;
>  
> +		if (*controllers == ':') /* unified hier */
> +			continue;
> +
>  		off = strchr(controllers, ':');
>  		if (!off) {
>  			pr_err("Unable to parse \"%s\"\n", buf);
> 
> 
> -- Pavel
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu