]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: when coming back from reload/reexec, reapply all cgroup properties
authorLennart Poettering <lennart@poettering.net>
Thu, 7 Sep 2017 12:32:33 +0000 (14:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 22 Sep 2017 13:24:55 +0000 (15:24 +0200)
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.

src/core/cgroup.c
src/core/unit.c

index c6667b39c78c4a4652b615b74b89c20e538dcaf6..e9cb0d35c91a6bb63dd369880dbb458def70b411 100644 (file)
@@ -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;
index 5ed57644551740c6e535112d2cb752a39da02e25..68295d64455cbb6972c6d44e2d5217995384262f 100644 (file)
@@ -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;
 }