diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-06-05 20:45:12 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-06-28 15:43:21 +0200 |
commit | f26b2ec46118a4493608618da2253bb9dfc6b517 (patch) | |
tree | 57ed80fd584bf88a095c8960a0c4fb10b5745403 /src/core/mount.c | |
parent | core: cast ignored retval of unit_realize_cgroup to void (diff) | |
download | systemd-f26b2ec46118a4493608618da2253bb9dfc6b517.tar.xz systemd-f26b2ec46118a4493608618da2253bb9dfc6b517.zip |
core: do not set up cgroup runtime on coldplug
Currently, unit_setup_cgroup_runtime() is called in
various _coldplug() functions if the unit is not inactive.
That seems unnecessary though, and kinda defeats the purpose
of CGroupRuntime. If we need to fork off a process for the unit
or got something during deserialization, the CGroupRuntime
would be automatically set up by unit_prepare_exec() /
cgroup_runtime_deserialize_one(). Otherwise it would mean
the cgroup doesn't exist and we don't need to allocate
that in the first place.
Plus, note that socket units might also carry a cgroup with
ExecStartPre=/ExecStartPost=/... Hence the existing code
is really inconsistent.
Diffstat (limited to 'src/core/mount.c')
-rw-r--r-- | src/core/mount.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/core/mount.c b/src/core/mount.c index c6100b0b0a..e040f151f4 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -764,10 +764,8 @@ static int mount_coldplug(Unit *u) { return r; } - if (!IN_SET(m->deserialized_state, MOUNT_DEAD, MOUNT_FAILED)) { + if (!IN_SET(m->deserialized_state, MOUNT_DEAD, MOUNT_FAILED)) (void) unit_setup_exec_runtime(u); - (void) unit_setup_cgroup_runtime(u); - } mount_set_state(m, m->deserialized_state); return 0; |