In cases when there is a cgroup tree in a controller hierarchy which was not created by us, but it looks like it was (i.e. cgroup path is the same as the one in systemd's named hierarchy) we shouldn't delete it. ---
Reproducer: 1) start qemu-kvm VM via virsh/virt-manager 2) ls /sys/fs/cgroup/memory /* see machine.slice cgroup */ 3) verify that scope unit for VM has MemoryAccounting=no 4) systemctl daemon-reload 5) systemctl restart <some_service> 6) ls /sys/fs/cgroup/memory /* see machine.slice cgroup gone */ To be honest I have no idea if the approach taken here is correct, however it fixes the bug at least on my machine. src/core/cgroup.c | 2 +- src/shared/cgroup-util.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 6c6e4f5..8ede79a 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -780,7 +780,7 @@ void unit_destroy_cgroup(Unit *u) { if (!u->cgroup_path) return; - r = cg_trim_everywhere(u->manager->cgroup_supported, u->cgroup_path, !unit_has_name(u, SPECIAL_ROOT_SLICE)); + r = cg_trim_everywhere(u->cgroup_realized_mask, u->cgroup_path, !unit_has_name(u, SPECIAL_ROOT_SLICE)); if (r < 0) log_debug("Failed to destroy cgroup %s: %s", u->cgroup_path, strerror(-r)); diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index da8e885..a19b5b4 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -1615,8 +1615,6 @@ int cg_create_everywhere(CGroupControllerMask supported, CGroupControllerMask ma NULSTR_FOREACH(n, mask_names) { if (mask & bit) cg_create(n, path); - else if (supported & bit) - cg_trim(n, path, true); bit <<= 1; } -- 2.0.1 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel