]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/transaction.c
core: introduce a new job mode JOB_RESTART_DEPENDENCIES
authorLennart Poettering <lennart@poettering.net>
Fri, 30 Jun 2023 16:17:06 +0000 (18:17 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 3 Jul 2023 15:31:25 +0000 (17:31 +0200)
commit09d04ad325473e05e23e6ba8382d7de1dd819bda
tree6baa9e91185272afed733efb419cd070c4a463d0
parent0c59d2e4abf383595069824b6504b6e9ba9e307a
core: introduce a new job mode JOB_RESTART_DEPENDENCIES

This new job mode will enqueue a start job for a unit, and all units
depending on the unit will get a restart job enqueued. This is then used
for automatic sevice restarts: the unit itself is only started, the
depending units restarted. This way the unit will not go down
unnecessarily, triggering OnSuccess= needlessly.

This also introduces a new state SERVICE_AUTO_RESTART_QUEUED that is
entered once the restart jobs are enqueued. Previously we'd stay in
SERVICE_AUTO_RESTART, but that's problematic, since we'd lose
information whether we still need to enqueue the restart job during a
serialization/deserialization cycle or not. By having an explicit state
for this we know exactly whether we still need to enqueue the job or
not. It's also good since when we are in SERVICE_AUTO_RESTART_QUEUED we
want to act on unit_start(), but on SERVICE_AUTO_RESTART we want to wait
for the holdoff time to pass before we act on unit_start().

Fixes: #27722
src/basic/unit-def.c
src/basic/unit-def.h
src/core/job.c
src/core/job.h
src/core/manager.c
src/core/service.c
src/core/transaction.c
src/core/transaction.h