]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(nvmf): avoid calling "exit" in a cmdline hook
authorMartin Wilck <mwilck@suse.com>
Fri, 16 Sep 2022 22:54:25 +0000 (00:54 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Fri, 30 Sep 2022 06:02:18 +0000 (06:02 +0000)
"exit" should never be executed in dracut hooks, because the
hooks are sourced by the main script.

modules.d/95nvmf/parse-nvmf-boot-connections.sh

index c8078a76e65e9ad8f5082f476ddf62c798175f05..cc545ee0e9a3c85ff39f78d554db2fa528038826 100755 (executable)
@@ -101,12 +101,12 @@ for d in $(getargs rd.nvmf.discover -d nvmf.discover=); do
 done
 
 # Host NQN and host id are mandatory for NVMe-oF
-[ -f "/etc/nvme/hostnqn" ] || exit 0
-[ -f "/etc/nvme/hostid" ] || exit 0
+if [ -f "/etc/nvme/hostnqn" ] && [ -f "/etc/nvme/hostid" ]; then
 
-# If no nvme command line arguments present, try autodiscovery
-if [ $NVMF_FC_AUTO ] || [ ! -f "/etc/nvme/discovery.conf" ]; then
-    /sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
-else
-    /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
+    # If no nvme command line arguments present, try autodiscovery
+    if [ $NVMF_FC_AUTO ] || [ ! -f "/etc/nvme/discovery.conf" ]; then
+        /sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
+    else
+        /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
+    fi
 fi