]> git.ipfire.org Git - thirdparty/systemd.git/commit
core/service: rework ExecReload= + Type=notify-reload interaction, add ExecReloadPost=
authorMike Yuan <me@yhndnzj.com>
Sun, 19 Oct 2025 21:23:17 +0000 (23:23 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 4 Nov 2025 11:18:33 +0000 (12:18 +0100)
commitb03e1b09af7cf305c762db94c779f78cd85bca80
tree2d538357e20a535d174244926cbdb286447e07be
parentb3c6709fde819be6cca7c075d8169cfd77865fa2
core/service: rework ExecReload= + Type=notify-reload interaction, add ExecReloadPost=

When Type=notify-reload got introduced, it wasn't intended to be
mutually exclusive with ExecReload=. However, currently ExecReload=
is immediately forked off after the service main process is signaled,
leaving states in between essentially undefined. Given so broken
it is I doubt any sane user is using this setup, hence I took a stab
to rework everything:

1.  Extensions are refreshed (unchanged)
2.  ExecReload= is forked off without signaling the process
3a. If RELOADING=1 is sent during the ExecReload= invocation,
    we'd refrain from signaling the process again, instead
    just transition to SERVICE_RELOAD_NOTIFY directly and
    wait for READY=1
3b. If not, signal the process after ExecReload= finishes
    (from now on the same as Type=notify-reload w/o ExecReload=)
4.  To accomodate the use case of performing post-reload tasks,
    ExecReloadPost= is introduced which executes after READY=1

The new model greatly simplifies things, as no control processes
will be around in SERVICE_RELOAD_SIGNAL and SERVICE_RELOAD_NOTIFY
states.

See also: https://github.com/systemd/systemd/issues/37515#issuecomment-2891229652
man/org.freedesktop.systemd1.xml
man/systemd.service.xml
src/basic/unit-def.c
src/basic/unit-def.h
src/core/dbus-service.c
src/core/load-fragment-gperf.gperf.in
src/core/service.c
src/core/service.h
src/shared/bus-unit-util.c
src/systemctl/systemctl-show.c