]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: do BindMount/MountImage operations in async control process
authorLuca Boccassi <bluca@debian.org>
Mon, 29 Apr 2024 15:14:12 +0000 (16:14 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 29 Aug 2024 11:48:55 +0000 (12:48 +0100)
commit5162829ec87df20c7af763bdf274735bf9e53552
tree06798c199c0d140c076bc499d1c70633d4e2b70a
parent5121f7c45b37afca53c89f42123b1dd6a04fa80f
core: do BindMount/MountImage operations in async control process

These operations might require slow I/O, and thus might block PID1's main
loop for an undeterminated amount of time. Instead of performing them
inline, fork a worker process and stash away the D-Bus message, and reply
once we get a SIGCHILD indicating they have completed. That way we don't
break compatibility and callers can continue to rely on the fact that when
they get the method reply the operation either succeeded or failed.

To keep backward compatibility, unlike reload control processes, these
are ran inside init.scope and not the target cgroup. Unlike ExecReload,
this is under our control and is not defined by the unit. This is necessary
because previously the operation also wasn't ran from the target cgroup,
so suddenly forking a copy-on-write copy of pid1 into the target cgroup
will make memory usage spike, and if there is a MemoryMax= or MemoryHigh=
set and the cgroup is already close to the limit, it will cause an OOM
kill, where previously it would have worked fine.
25 files changed:
man/org.freedesktop.systemd1.xml
man/systemctl.xml
man/systemd.xml
src/basic/unit-def.c
src/basic/unit-def.h
src/core/dbus-service.c
src/core/dbus-unit.c
src/core/job.c
src/core/manager.c
src/core/scope.c
src/core/service.c
src/core/service.h
src/core/socket.c
src/core/unit.c
src/core/unit.h
src/machine/machine-dbus.c
src/shared/bus-wait-for-units.c
src/shared/mount-util.c
src/shared/mount-util.h
src/systemctl/systemctl-is-active.c
src/systemctl/systemctl-list-dependencies.c
src/systemctl/systemctl-list-units.c
src/systemctl/systemctl-show.c
src/systemctl/systemctl-util.c
test/units/TEST-23-UNIT-FILE.runtime-bind-paths.sh