]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: increment start limit counter only when we can start the unit
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 Oct 2025 10:40:28 +0000 (19:40 +0900)
committerMike Yuan <me@yhndnzj.com>
Thu, 23 Oct 2025 13:51:28 +0000 (15:51 +0200)
commit8eefd0f4debc0bcfeea89dd39c43e3318f3f7ae7
tree5783f1a0c80f965ef1ff01ad99fbe01c6899c044
parentc05758663b162c64da4729944023dec8cf684c75
core: increment start limit counter only when we can start the unit

Otherwise, e.g. requesting to start a unit that is under stopping may
enter the failed state.

This makes
- rename .can_start() -> .test_startable(), and make it allow to return
  boolean and refuse to start units when it returns false,
- refuse earlier to start units that are in the deactivating state, so
  several redundant conditions in .start() can be dropped,
- move checks for unit states mapped to UNIT_ACTIVATING from .start() to
  .test_startable().

Fixes #39247.
src/core/automount.c
src/core/mount.c
src/core/path.c
src/core/service.c
src/core/socket.c
src/core/swap.c
src/core/timer.c
src/core/unit.c
src/core/unit.h
test/units/TEST-07-PID1.start-limit.sh [new file with mode: 0755]