chiark / gitweb /
core: don't consider a unit's cgroup empty if only a subcgroup runs empty
authorLennart Poettering <lennart@poettering.net>
Tue, 2 Jul 2013 14:24:13 +0000 (16:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Jul 2013 14:24:13 +0000 (16:24 +0200)
src/core/cgroup.c

index cdccf3f..c7f1e77 100644 (file)
@@ -728,16 +728,15 @@ int manager_notify_cgroup_empty(Manager *m, const char *cgroup) {
         assert(m);
         assert(cgroup);
 
-        r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, cgroup, true);
-        if (r == 0)
-                return 0;
-
         u = manager_get_unit_by_cgroup(m, cgroup);
         if (u) {
-                if (UNIT_VTABLE(u)->notify_cgroup_empty)
-                        UNIT_VTABLE(u)->notify_cgroup_empty(u);
+                r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, true);
+                if (r > 0) {
+                        if (UNIT_VTABLE(u)->notify_cgroup_empty)
+                                UNIT_VTABLE(u)->notify_cgroup_empty(u);
 
-                unit_add_to_gc_queue(u);
+                        unit_add_to_gc_queue(u);
+                }
         }
 
         return 0;