systemd/cpi.service: fix race condition between stopping unit and shutdown

There is a race condition between stopping the cpi systemd service and
systemd getting a request to exit the main loop, so it may proceed with
shutdown before all pending stop jobs have been processed. Therefore,
add `Before=shutdown.target` as it would have been added by
the (deactivated) default dependencies. [1]

While at it, sort the directives.

[1] https://www.freedesktop.org/software/systemd/man/systemd.service.html#Default%20Dependencies

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2023-07-27 12:31:09 +02:00
committed by Jan Höppner
parent 7bb41732fb
commit bbe92b9cd3

View File

@@ -7,11 +7,12 @@
#
[Unit]
Description=Apply Control Program Identification (CPI)
DefaultDependencies=no
Conflicts=shutdown.target
After=sysinit.target
Before=shutdown.target
ConditionPathIsReadWrite=/sys/firmware/cpi
Conflicts=shutdown.target
DefaultDependencies=no
Description=Apply Control Program Identification (CPI)
[Service]
Type=oneshot