diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-09-07 14:32:33 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-09-22 15:24:55 +0200 |
commit | 58d83430e1276fe8d1224c2b5f76e756d143a375 (patch) | |
tree | 6f54acc9bcc67e73964e696fa7f4cdafa616f3f1 | |
parent | 6b659ed87e98a69ab60ce2220f50a64af54a21d3 (diff) | |
download | systemd-58d83430e1276fe8d1224c2b5f76e756d143a375.tar.gz |
core: when coming back from reload/reexec, reapply all cgroup properties
With this change we'll invalidate all cgroup settings after coming back
from a daemon reload/reexec, so that the new settings are instantly
applied.
This is useful for the BPF case, because we don't serialize/deserialize
the BPF program fd, and hence have to install a new, updated BPF program
when coming back from the reload/reexec. However, this is also useful
for the rest of the cgroup settings, as it ensures that user
configuration really takes effect wherever we can.
-rw-r--r-- | src/core/cgroup.c | 1 | ||||
-rw-r--r-- | src/core/unit.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c index c6667b39c7..e9cb0d35c9 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -1533,6 +1533,7 @@ static int unit_realize_cgroup_now(Unit *u, ManagerState state) { } static void unit_add_to_cgroup_queue(Unit *u) { + assert(u); if (u->in_cgroup_queue) return; diff --git a/src/core/unit.c b/src/core/unit.c index 5ed5764455..68295d6445 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3205,6 +3205,11 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { if (!dual_timestamp_is_set(&u->state_change_timestamp)) dual_timestamp_get(&u->state_change_timestamp); + /* Let's make sure that everything that is deserialized also gets any potential new cgroup settings applied + * after we are done. For that we invalidate anything already realized, so that we can realize it again. */ + unit_invalidate_cgroup(u, _CGROUP_MASK_ALL); + unit_invalidate_cgroup_bpf(u); + return 0; } |