chiark / gitweb /
unit: save description/slice of transient units to /run
[elogind.git] / src / core / cgroup.c
index cdccf3ff152411167620cf1eee79d65ffe6fac82..b5d13478561831124abc69301c8094b2d373c1c4 100644 (file)
@@ -533,7 +533,7 @@ void unit_destroy_cgroup(Unit *u) {
 
         r = cg_trim_with_mask(u->cgroup_mask, u->cgroup_path, true);
         if (r < 0)
-                log_error("Failed to destroy cgroup %s: %s", u->cgroup_path, strerror(-r));
+                log_debug("Failed to destroy cgroup %s: %s", u->cgroup_path, strerror(-r));
 
         hashmap_remove(u->manager->cgroup_unit, u->cgroup_path);
 
@@ -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;