[CRIU] [PATCH] cgroup: Skip unified hier controllers

Pavel Emelyanov xemul at virtuozzo.com
Fri Jun 23 14:13:12 MSK 2017


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 at lisas.de>
Signed-off-by: Pavel Emelyanov <xemul at 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 */
+				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


More information about the CRIU mailing list