mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
cgroups: don't take into account a leading / for the "/" parent
Without this patch, we dump somethin like this:
{
cnames: "hugetlb"
dirs: {
dir_name: ""
children: {
dir_name: "ewroot"
children: <empty>
properties: <empty>
}
properties: <empty>
}
}
It's obvious, that dir_name should be newroot.
The problem is reproduced, if a task leaves in "/" and has a subgroup.
This issue was caught by a chance. The cgroup02 test doesn't clean up
controllers and leaves the "newroot" there. So when we executed a cgroup
test after cgroup02, we could find many directories like "ewroot",
"wroot", etc. This patch fixes this issue.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
601e5bb485
commit
c5c7272c50
1 changed files with 3 additions and 1 deletions
4
cgroup.c
4
cgroup.c
|
|
@ -676,7 +676,9 @@ static int dump_cg_dirs(struct list_head *dirs, size_t n_dirs, CgroupDirEntry **
|
|||
|
||||
list_for_each_entry(cur, dirs, siblings) {
|
||||
cgroup_dir_entry__init(cde);
|
||||
cde->dir_name = cur->path + poff + 1 /* leading / */;
|
||||
cde->dir_name = cur->path + poff;
|
||||
if (poff != 1) /* parent isn't "/" */
|
||||
cde->dir_name++; /* leading / */
|
||||
cde->n_children = cur->n_children;
|
||||
if (cur->n_children > 0)
|
||||
if (dump_cg_dirs(&cur->children, cur->n_children, &cde->children, strlen(cur->path)) < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue