chiark / gitweb /
unit: trim cgroups when going down
[elogind.git] / src / unit.c
index a5f8712ae6d1101b358ad092095b4bfa6c002ea5..18faae22e47c48b98bcbb9918e26014f354c1400 100644 (file)
@@ -970,6 +970,12 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
         else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns))
                 u->meta.active_exit_timestamp = ts;
 
+        if (ns != os && ns == UNIT_MAINTENANCE)
+                log_notice("Unit %s entered maintenance state.", u->meta.id);
+
+        if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns))
+                cgroup_bonding_trim_list(u->meta.cgroup_bondings, true);
+
         timer_unit_notify(u, ns);
         path_unit_notify(u, ns);