From bbe92b9cd37c6b30348c54e7faa9b8bae64764b5 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Thu, 27 Jul 2023 12:31:09 +0200 Subject: [PATCH] systemd/cpi.service: fix race condition between stopping unit and shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- systemd/cpi.service.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/systemd/cpi.service.in b/systemd/cpi.service.in index 3c961c74..f14e7e0d 100644 --- a/systemd/cpi.service.in +++ b/systemd/cpi.service.in @@ -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