cgroup: don't trim cgroup trees created by someone else
authorMichal Sekletar <msekleta@redhat.com>
Fri, 19 Sep 2014 15:14:10 +0000 (17:14 +0200)
committerMichael Biebl <biebl@debian.org>
Tue, 25 Sep 2018 14:11:12 +0000 (15:11 +0100)
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

Gbp-Pq: Topic debian
Gbp-Pq: Name cgroup-don-t-trim-cgroup-trees-created-by-someone-el.patch

src/basic/cgroup-util.c
src/core/cgroup.c

index 038ece4b06b1cfc7613f4513800be0b644c76f90..1d20bb5ffbe2dd53c2975f5754e991e55e41bd26 100644 (file)
@@ -2135,8 +2135,6 @@ int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path
 
                 if (mask & bit)
                         (void) cg_create(n, path);
-                else if (supported & bit)
-                        (void) cg_trim(n, path, true);
         }
 
         return created;
index bb02436203f5ba313be8e2be82a1f214010737f6..1b695c60287793985520375798ef2571824d1324 100644 (file)
@@ -1858,7 +1858,7 @@ void unit_prune_cgroup(Unit *u) {
 
         is_root_slice = unit_has_name(u, SPECIAL_ROOT_SLICE);
 
-        r = cg_trim_everywhere(u->manager->cgroup_supported, u->cgroup_path, !is_root_slice);
+        r = cg_trim_everywhere(u->cgroup_realized_mask, u->cgroup_path, !is_root_slice);
         if (r < 0) {
                 log_unit_debug_errno(u, r, "Failed to destroy cgroup %s, ignoring: %m", u->cgroup_path);
                 return;