]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: Fix ordering for auto connect services
authorDaniel Wagner <dwagner@suse.de>
Tue, 7 Mar 2023 09:24:01 +0000 (10:24 +0100)
committerDaniel Wagner <wagi@monom.org>
Tue, 7 Mar 2023 09:44:21 +0000 (10:44 +0100)
In order to be able to mount file systems via /etc/fstab we have to
make sure that the corresponding auto connect services have been
executed. Because the mounting of the local filesystem happens very
early in the boot we have to carefully sort these service file into the
boot process.

First, we have to disable the DefaultDependency as this will
automatically add dependency on sysinit.target which is too late (after
local mounts). Though without the default dependency we have to provide
a Before and After conditions.

The Before is simple as we have a local-fs-pre target. The After
is a bit tricky as there are no targets available.

Because the whole autoconnect machinery depends on udev events being
delivered we place the service after systemd-udevd has been started.

Link: https://www.freedesktop.org/software/systemd/man/bootup.html
Reported-by: Maurizio Lombardi <mlombard@redhat.com>
Reported-by: Wen Xiong <wenxiong@linux.ibm.com>
Tested-by: Maurizio Lombardi <mlombard@redhat.com>
Tested-by: Wen Xiong <wenxiong@linux.ibm.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvmf-autoconnect/systemd/nvmefc-boot-connections.service.in
nvmf-autoconnect/systemd/nvmf-connect@.service.in

index 33ab8c1f610fb8b7ddb220650a3664cc0d1e20da..7036625c778863488274208dd001aa2ff94d5226 100644 (file)
@@ -1,6 +1,9 @@
 [Unit]
 Description=Auto-connect to subsystems on FC-NVME devices found during boot
 ConditionPathExists=/sys/class/fc/fc_udev_device/nvme_discovery
+DefaultDependencies=no
+After=systemd-udevd.service
+Before=local-fs-pre.target
 
 [Service]
 Type=oneshot
index 90f774c55aec96dc9a5febd8ffe0758a7193607b..dd245ee6e636bf5111a25560ebc318989877befa 100644 (file)
@@ -4,7 +4,9 @@
 
 [Unit]
 Description=NVMf auto-connect scan upon nvme discovery controller Events
-After=syslog.target
+DefaultDependencies=no
+After=systemd-udevd.service
+Before=local-fs-pre.target
 PartOf=nvmf-connect.target
 Requires=nvmf-connect.target