1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-04 21:47:31 +03:00

Merge pull request #14534 from poettering/cgroup-sibling-fix

core: fix re-realization of cgroup siblings
This commit is contained in:
Anita Zhang 2020-01-09 23:57:39 -08:00 committed by GitHub
commit e127d90210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2334,29 +2334,25 @@ unsigned manager_dispatch_cgroup_realize_queue(Manager *m) {
static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) { static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
Unit *slice; Unit *slice;
/* This adds the siblings of the specified unit and the /* This adds the siblings of the specified unit and the siblings of all parent units to the cgroup
* siblings of all parent units to the cgroup queue. (But * queue. (But neither the specified unit itself nor the parents.) */
* neither the specified unit itself nor the parents.) */
while ((slice = UNIT_DEREF(u->slice))) { while ((slice = UNIT_DEREF(u->slice))) {
Iterator i; Iterator i;
Unit *m; Unit *m;
void *v; void *v;
HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE], i) { HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) {
/* Skip units that have a dependency on the slice /* Skip units that have a dependency on the slice but aren't actually in it. */
* but aren't actually in it. */
if (UNIT_DEREF(m->slice) != slice) if (UNIT_DEREF(m->slice) != slice)
continue; continue;
/* No point in doing cgroup application for units /* No point in doing cgroup application for units without active processes. */
* without active processes. */
if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m))) if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m)))
continue; continue;
/* If the unit doesn't need any new controllers /* If the unit doesn't need any new controllers and has current ones realized, it
* and has current ones realized, it doesn't need * doesn't need any changes. */
* any changes. */
if (unit_has_mask_realized(m, if (unit_has_mask_realized(m,
unit_get_target_mask(m), unit_get_target_mask(m),
unit_get_enable_mask(m))) unit_get_enable_mask(m)))