diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-03-24 16:04:34 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-03-29 17:22:07 +0200 |
commit | a1d315730ffddf283d4bb9d73878fbcd97a4d244 (patch) | |
tree | ca1ab2e3e90d037139306f6d8d72aad8b03e5d8f /src/core/manager-dump.c | |
parent | 8732cfb4bfae657018fea500abb1f1ed4e62a5c4 (diff) | |
download | systemd-a1d315730ffddf283d4bb9d73878fbcd97a4d244.tar.gz |
pid1: introduce new SERVICE_{DEAD|FAILED}_BEFORE_AUTO_RESTART service substates
When a service deactivates and is then automatically restarted via
Restart= we currently quickly transition through
SERVICE_DEAD/SERVICE_FAILED. Which is weird given it's not the
normal ("permanent") dead/failed state, but a transitory one we
immediately leave from again. We do this so that software that looks for
failures/successes can take notice, even if we restart as a consequence
of the deactivation.
Let's clean this up a bit: let's introduce two new states:
SERVICE_DEAD_BEFORE_AUTO_RESTART and SERVICE_FAILED_BEFORE_AUTO_RESTART
that are used for the transitory states. Both the SERVICE_DEAD and
SERVICE_DEAD_BEFORE_AUTO_RESTART will map to the high-level
UNIT_INACTIVE state though. (and similar for the respective failed
states). This means the high-level state machine won't change by this,
only the low-level one.
This clearly seperates the substates, which makes the state engine
cleaner, and allows clients to follow precisely whether we are in a
transitory dead/failed state, or a permanent one, by looking at the
service substate. Moreover it allows us to remove the 'n_keep_fd_store'
which so far we used to ensure the fdstore was not released during this
transitory dead/failed state but only during the permanent one. Since we
can now distinguish these states properly we can just use that.
This has been bugging me for a while. Let's clean this up.
Note that the unit restart logic is already nicely covered in the
testsiute, hence this adds no new tests for that.
And yes, this could be considered a compat break, but sofar we took the
liberty to make changes to the low-level state machine (i.e. SERVICE_xyz
states, sometimes called "substates") without considering this a bad
breakage – the high-level state machine (i.e. UNIT_xyz states) should
be considered API that cannot be changed.
Diffstat (limited to 'src/core/manager-dump.c')
0 files changed, 0 insertions, 0 deletions