Blob Blame History Raw
From f0ac6cb462930010e4756df4ce1ce0f8aa60b08f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.com>
Date: Mon, 28 Sep 2020 13:39:07 +0200
Subject: [PATCH] 95nvmf: Fixup FC connections

D-Bus doesn't run in the initrd, so our usual trick of activating
custom systemd services from udev doesn't work.
So add a rule to create initqueue entries for each possible
connection.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/95nvmf/95-nvmf-initqueue.rules | 10 ++++++++++
 modules.d/95nvmf/module-setup.sh         |  5 +----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules.d/95nvmf/95-nvmf-initqueue.rules b/modules.d/95nvmf/95-nvmf-initqueue.rules
new file mode 100644
index 00000000..d26d7b09
--- /dev/null
+++ b/modules.d/95nvmf/95-nvmf-initqueue.rules
@@ -0,0 +1,10 @@
+#
+# nvmf-initqueue.rules
+#
+# D-Bus doesn't run in the initrd, which means that we cannot use our
+# usual trick of starting custom systemd services.
+# So use a rule to create initqueue entries instead.
+
+ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
+      ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \
+      RUN+="/sbin/initqueue --onetime --unique --name nvmf-connect-$env{NVMEFC_TRADDR}-$env{NVMEFC_HOST_TRADDR} /usr/sbin/nvme connect-all --transport=fc --traddr=$env{NVMEFC_TRADDR} --host-traddr=$env{NVMEFC_HOST_TRADDR}"
diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh
index 92400c21..501ba8dd 100755
--- a/modules.d/95nvmf/module-setup.sh
+++ b/modules.d/95nvmf/module-setup.sh
@@ -110,12 +110,9 @@ install() {
     inst_multiple ip sed
 
     inst_multiple nvme
-    inst_multiple -o \
-        "$systemdsystemunitdir/nvm*-connect@.service" \
-        "$systemdsystemunitdir/nvm*-connect.target"
     inst_hook cmdline 99 "$moddir/parse-nvmf-boot-connections.sh"
     inst_simple "/etc/nvme/discovery.conf"
-    inst_rules /usr/lib/udev/rules.d/70-nvm*-autoconnect.rules
     inst_rules /usr/lib/udev/rules.d/71-nvmf-iopolicy-netapp.rules
+    inst_rules "$moddir/95-nvmf-initqueue.rules"
     dracut_need_initqueue
 }