[CRIU] [PATCH 07/11] cgroup: Split net_prio.ifpriomap writes

Dmitry Safonov dsafonov at virtuozzo.com
Wed Jul 26 00:08:12 MSK 2017


At this moment the kernel doesn't support multi-line write()
to net_prio.ifpriomap. On such write the kernel will parse
only the first line.

That results in the following failed restore:
> (01.454153) cg: Restoring cgroup property value [lo 0
> enp5s0 0
> enp6s0 0
> br0 0
> venet0 0
> host-routed 0
> virbr0 0
> virbr0-nic 0] to [net_prio,net_cls/machine.slice/91d3ac46-380e-4d91-89d3-d2bd1eb30f97/net_prio.ifpriomap]
> (01.454188) Error (criu/cgroup.c:1225): cg: Failed writing lo 0
> enp5s0 0
> enp6s0 0
> br0 0
> venet0 0
> host-routed 0
> virbr0 0
> virbr0-nic 0 to net_prio,net_cls/machine.slice/91d3ac46-380e-4d91-89d3-d2bd1eb30f97/net_prio.ifpriomap: Argument list too long
> (01.472144) Error (criu/cr-restore.c:1013): 20509 killed by signal 9: Killed
> (01.472391) mnt: Switching to new ns to clean ghosts
> (01.472690) Error (criu/cr-restore.c:2007): Restoring FAILED.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cgroup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index 51e68b7f2dda..0d2092acaf81 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -1322,6 +1322,7 @@ static int prepare_cgroup_dir_properties(char *path, int off, CgroupDirEntry **e
 		off2 += sprintf(path + off, "/%s", e->dir_name);
 		for (j = 0; j < e->n_properties; ++j) {
 			CgroupPropEntry *p = e->properties[j];
+			bool split = false;
 
 			if (!strcmp(p->name, "freezer.state")) {
 				add_freezer_state_for_restore(p, path, off2);
@@ -1336,7 +1337,11 @@ static int prepare_cgroup_dir_properties(char *path, int off, CgroupDirEntry **e
 			if (is_special_property(p->name))
 				continue;
 
-			if (restore_cgroup_prop(p, path, off2, false) < 0)
+			/* The kernel can't handle it in one write() */
+			if (strcmp(p->name, "net_prio.ifpriomap") == 0)
+				split = true;
+
+			if (restore_cgroup_prop(p, path, off2, split) < 0)
 				return -1;
 		}
 skip:
-- 
2.13.3



More information about the CRIU mailing list