]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(iscsi): add support for the new iscsiadm "no-wait" (-W) command
authorThomas Blume <Thomas.Blume@suse.com>
Thu, 1 Jul 2021 08:36:09 +0000 (10:36 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Tue, 17 Aug 2021 07:47:20 +0000 (07:47 +0000)
remove connection timeout for iscsi firmware targets serving system root

modules.d/95iscsi/iscsiroot.sh
modules.d/95iscsi/module-setup.sh

index 1a6446508a6499e95787a0320a9b82a27d240317..946cb03ec5e3094ac1e2ce3572e466ad526e8bed 100755 (executable)
@@ -45,7 +45,7 @@ if [ -z "${DRACUT_SYSTEMD}" ] \
 fi
 
 handle_firmware() {
-    local ifaces retry
+    local ifaces retry _res
 
     # Depending on the 'ql4xdisablesysfsboot' qla4xxx
     # will be autostarting sessions without presenting
@@ -69,9 +69,28 @@ handle_firmware() {
             rm /tmp/session-retry
         fi
 
-        if ! iscsiadm -m fw -l; then
+        # check to see if we have the new iscsiadm command,
+        # that supports the "no-wait" (-W) flag. If so, use it.
+        iscsiadm -m fw -l -W 2> /dev/null
+        _res=$?
+        if [ $_res -eq 7 ]; then
+            # ISCSI_ERR_INVALID (7) => "-W" not supported
+            info "iscsiadm does not support no-wait firmware logins"
+            iscsiadm -m fw -l
+            _res=$?
+        fi
+        if [ $_res -ne 0 ]; then
             warn "iscsiadm: Log-in to iscsi target failed"
         else
+            # get a list of connected targets
+            tgts=$(cat /sys/firmware/ibft/target*/target-name | sort -u)
+            # disable NOPs for each FW target
+            for tgt in ${tgts}; do
+                iscsiadm -m node -T "${tgt}" \
+                    --op update \
+                    --name 'node.conn[0].timeo.noop_out_interval' --value 0 \
+                    --name 'node.conn[0].timeo.noop_out_timeout' --value 0
+            done
             need_shutdown
         fi
     fi
index 88d6c92baea4691188f294809ee2bbfe3078e555..1ae914ea9c420dfce1a20749c8f35822bd756563 100755 (executable)
@@ -188,6 +188,7 @@ install() {
     inst_multiple -o iscsiuio
     inst_libdir_file 'libgcc_s.so*'
     inst_multiple umount iscsi-iname iscsiadm iscsid
+    inst_binary sort
 
     inst_multiple -o \
         "$systemdsystemunitdir"/iscsid.socket \