Commit 8b33970e authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

cgroup: skip restoring special cpuset props during main prop restore

As the comment says, we don't need to restore speical cpuset props twice,
and indeed it can cause the restore to fail, e.g.:

(00.092356) Error (cgroup.c:1240): cg: Failed writing 0-3 to cpuset//lxc/centoss/cpuset.cpus
(00.582490)     18: Error (cgroup.c:1009): cg: Can't move 18 into systemd//lxc/centos/system.slice/systemd-journald.service/tasks (-1/-1): No such file or directory
(00.582497)     18: Error (cgroup.c:1124): cg: Can't move into systemd//lxc/centos/system.slice/systemd-journald.service/tasks (-1/-1): No such file or directory
(00.582567)     43: Error (cgroup.c:1009): cg: Can't move 43 into systemd//lxc/centos/system.slice/console-getty.service/tasks (-1/-1): No such file or directory
(00.582573)     43: Error (cgroup.c:1124): cg: Can't move into systemd//lxc/centos/system.slice/console-getty.service/tasks (-1/-1): No such file or directory
(00.582886)      1: Error (cr-restore.c:1306): 18 exited, status=1
(00.594670) Error (cr-restore.c:1308): 7906 killed by signal 9
(00.623099) Error (cr-restore.c:2138): Restoring FAILED.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f4832fb2
......@@ -1308,10 +1308,29 @@ static int prepare_cgroup_dir_properties(char *path, int off, CgroupDirEntry **e
off2 += sprintf(path + off, "/%s", e->dir_name);
if (e->n_properties > 0) {
for (j = 0; j < e->n_properties; ++j) {
int k;
bool special = false;
if (!strcmp(e->properties[j]->name, "freezer.state")) {
add_freezer_state_for_restore(e->properties[j], path, off2);
continue; /* skip restore now */
}
/* Skip restoring special cpuset props now.
* They were restored earlier, and can cause
* the restore to fail if some other task has
* entered the cgroup.
*/
for (k = 0; special_cpuset_props[k]; k++) {
if (!strcmp(e->properties[j]->name, special_cpuset_props[k])) {
special = true;
break;
}
}
if (special)
continue;
if (restore_cgroup_prop(e->properties[j], path, off2) < 0)
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment