mirror of
https://github.com/systemd/systemd.git
synced 2026-08-02 22:20:20 +00:00
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.
This commit is contained in:
committed by
Luca Boccassi
parent
5121f7c45b
commit
5162829ec8
@@ -112,6 +112,7 @@ static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
|
||||
[UNIT_ACTIVATING] = "activating",
|
||||
[UNIT_DEACTIVATING] = "deactivating",
|
||||
[UNIT_MAINTENANCE] = "maintenance",
|
||||
[UNIT_REFRESHING] = "refreshing",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(unit_active_state, UnitActiveState);
|
||||
@@ -234,6 +235,7 @@ static const char* const service_state_table[_SERVICE_STATE_MAX] = {
|
||||
[SERVICE_AUTO_RESTART] = "auto-restart",
|
||||
[SERVICE_AUTO_RESTART_QUEUED] = "auto-restart-queued",
|
||||
[SERVICE_CLEANING] = "cleaning",
|
||||
[SERVICE_MOUNTING] = "mounting",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(service_state, ServiceState);
|
||||
@@ -344,6 +346,7 @@ SpecialGlyph unit_active_state_to_glyph(UnitActiveState state) {
|
||||
static const SpecialGlyph map[_UNIT_ACTIVE_STATE_MAX] = {
|
||||
[UNIT_ACTIVE] = SPECIAL_GLYPH_BLACK_CIRCLE,
|
||||
[UNIT_RELOADING] = SPECIAL_GLYPH_CIRCLE_ARROW,
|
||||
[UNIT_REFRESHING] = SPECIAL_GLYPH_CIRCLE_ARROW,
|
||||
[UNIT_INACTIVE] = SPECIAL_GLYPH_WHITE_CIRCLE,
|
||||
[UNIT_FAILED] = SPECIAL_GLYPH_MULTIPLICATION_SIGN,
|
||||
[UNIT_ACTIVATING] = SPECIAL_GLYPH_BLACK_CIRCLE,
|
||||
|
||||
@@ -47,6 +47,7 @@ typedef enum UnitActiveState {
|
||||
UNIT_ACTIVATING,
|
||||
UNIT_DEACTIVATING,
|
||||
UNIT_MAINTENANCE,
|
||||
UNIT_REFRESHING,
|
||||
_UNIT_ACTIVE_STATE_MAX,
|
||||
_UNIT_ACTIVE_STATE_INVALID = -EINVAL,
|
||||
} UnitActiveState;
|
||||
@@ -137,6 +138,7 @@ typedef enum ServiceState {
|
||||
SERVICE_RELOAD, /* Reloading via ExecReload= */
|
||||
SERVICE_RELOAD_SIGNAL, /* Reloading via SIGHUP requested */
|
||||
SERVICE_RELOAD_NOTIFY, /* Waiting for READY=1 after RELOADING=1 notify */
|
||||
SERVICE_MOUNTING, /* Performing a live mount into the namespace of the service */
|
||||
SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
|
||||
SERVICE_STOP_WATCHDOG,
|
||||
SERVICE_STOP_SIGTERM,
|
||||
|
||||
Reference in New Issue
Block a user