Commit 255ae60e authored by Martin Pitt's avatar Martin Pitt

cgroup: Don't trim cgroup trees created by someone else

Just the ones that systemd itself created. This avoids cleaning up empty
cgroups from e. g. LXC.

Closes: #777601
parent 496110f3
......@@ -15,6 +15,9 @@ systemd (215-12) UNRELEASED; urgency=medium
* Add unit-config autopkgtest to check systemd unit/sysv init enabling and
disabling via systemctl. This avoids bugs like #777613 (did not affect
unstable).
* cgroup: Don't trim cgroup trees created by someone else, just the ones
that systemd itself created. This avoids cleaning up empty cgroups from e.
g. LXC. (Closes: #777601)
[ Didier Roche ]
* default-display-manager-generator: Avoid unecessary /dev/null symlink and
......
From: Michal Sekletar <msekleta@redhat.com>
Date: Fri, 19 Sep 2014 17:14:10 +0200
Subject: cgroup: don't trim cgroup trees created by someone else
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.
Origin: http://lists.freedesktop.org/archives/systemd-devel/2014-September/023276.html
Bug-Debian: https://bugs.debian.org/777601
---
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 35b862d..1749305 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -818,7 +818,7 @@ void unit_destroy_cgroup_if_empty(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_errno(r, "Failed to destroy cgroup %s: %m", u->cgroup_path);
return;
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 1bcba01..b1d92b5 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;
}
......@@ -183,3 +183,4 @@ Add-env-variable-for-machine-ID-path.patch
Prefer-etc-X11-default-display-manager-if-present.patch
Fix-usr-remount-failure-for-split-usr.patch
Only-start-logind-if-D-BUS-is-installed.patch
cgroup-don-t-trim-cgroup-trees-created-by-someone-el.patch
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