Commit f8a06e7a authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

cgroup: allow restoring from multi-headed freezer cgroups

b428a3a2 allows dumping containers with
multi-headed freezer cgroups, but we can't restore these containers without
some help at restore time too.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 34b5e8f8
......@@ -1198,9 +1198,27 @@ int restore_freezer_state(void)
static void add_freezer_state_for_restore(CgroupPropEntry *entry, char *path, size_t path_len)
{
BUG_ON(freezer_state_entry);
BUG_ON(path_len >= sizeof(freezer_path));
if (freezer_state_entry) {
int max_len, i;
max_len = strlen(freezer_path);
if (max_len > path_len)
max_len = path_len;
/* If there are multiple freezer.state properties, that means they had
* one common path prefix with no tasks in it. Let's find that common
* prefix.
*/
for (i = 0; i < max_len; i++) {
if (freezer_path[i] != path[i]) {
freezer_path[i] = 0;
return;
}
}
}
freezer_state_entry = entry;
/* Path is not null terminated at path_len */
strncpy(freezer_path, path, path_len);
......
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