Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package open-iscsi for openSUSE:Factory checked in at 2022-02-17 00:29:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/open-iscsi (Old) and /work/SRC/openSUSE:Factory/.open-iscsi.new.1956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "open-iscsi" Thu Feb 17 00:29:52 2022 rev:113 rq:954406 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/open-iscsi/open-iscsi.changes 2021-11-13 22:48:29.781248598 +0100 +++ /work/SRC/openSUSE:Factory/.open-iscsi.new.1956/open-iscsi.changes 2022-02-17 00:29:55.345439589 +0100 @@ -1,0 +2,6 @@ +Mon Feb 14 20:21:31 UTC 2022 - Lee Duncan <ldun...@suse.com> + +- Updated to latest upstream 2.1.6 as 2.1.6-suse, which contains + bug fixes and cleanups. See the Changelog for more details. + +------------------------------------------------------------------- Old: ---- open-iscsi-2.1.5-suse.tar.bz2 New: ---- open-iscsi-2.1.6-suse.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ open-iscsi.spec ++++++ --- /var/tmp/diff_new_pack.r2ReYJ/_old 2022-02-17 00:29:56.081439462 +0100 +++ /var/tmp/diff_new_pack.r2ReYJ/_new 2022-02-17 00:29:56.089439461 +0100 @@ -1,7 +1,7 @@ # # spec file for package open-iscsi # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,10 +22,10 @@ %endif %define iscsi_minor_release 1 -%define iscsi_patch_release 5 +%define iscsi_patch_release 6 %define iscsi_patch_release_suse %{iscsi_patch_release}-suse Name: open-iscsi -Version: 2.1.5 +Version: 2.1.6 Release: 0 Summary: Linux iSCSI Software Initiator License: GPL-2.0-or-later @@ -205,6 +205,7 @@ %{_mandir}/man8/iscsistart.8%{ext_man} %{_mandir}/man8/iscsi-iname.8%{ext_man} %{_mandir}/man8/iscsi_fw_login.8%{ext_man} +%{_mandir}/man8/iscsi-gen-initiatorname.8%{ext_man} %{_udevrulesdir}/50-iscsi-firmware-login.rules %files -n libopeniscsiusr0_2_0 ++++++ open-iscsi-2.1.5-suse.tar.bz2 -> open-iscsi-2.1.6-suse.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/Changelog new/open-iscsi-2.1.6-suse/Changelog --- old/open-iscsi-2.1.5-suse/Changelog 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/Changelog 2022-02-14 21:24:47.000000000 +0100 @@ -1,3 +1,45 @@ +-> open-iscsi-2.1.5 - open-iscsi-2.1.6 + +Chris Leech (1): + libopeniscsiusr: extend sysfs ignore_error to include EINVAL + +Lee Duncan (15): + Fix compiler error introduced with recent IPv6 commit. + Remove dependences from iscsi-init.service + Use "sbindir" for path in systemd service files + Updated README a bit + Finish ability to have binary location configurable. + Fix iscsi-init so that it runs when root writable + remove redundant params in Makefile + Fixing last parts of sbindir configuration + Cosmetic cleanup on recent addition + Update the iscsi-gen-initiatorname script: harden and generalize + change iscsi-gen-initiatorname option -b => -p + Add man page for the iscsi-gen-initiatorname script. + Install new man page for iscsi-gen-initiatorname + Fix issues discovered by gcc12 + Fix more issues discovered by gcc12 + +Mike Christie (4): + iscsi sysfs: check state before onlining devs + iscsistart: fix login timeout handling + iscsid: use infinite timeout if passed in + iscsid: add error code for req timeouts + +Samy Mahmoudi (1): + Improve 'iscsid.conf' + +Wenchao Hao (8): + iscsiadm: Call log_init() first to fix a segmentation fault + iscsi_err: Add iscsid request timed out error messages + Fix wrong install_systemd destination path + actor: add name to struct actor and init it with function name + actor: print thread name in log + actor: enhanced: print error log when init a initilized thread + initiator_common: make set operational parameter log easy to read + iscsid: Check session id before start sync a thread + + open-iscsi-2.1.4 - open-iscsi-2.1.5 Chris Leech (1): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/Makefile new/open-iscsi-2.1.6-suse/Makefile --- old/open-iscsi-2.1.5-suse/Makefile 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/Makefile 2022-02-14 21:24:47.000000000 +0100 @@ -6,6 +6,8 @@ # that you want everything installed into. DESTDIR ?= +SED = /usr/bin/sed + prefix = /usr exec_prefix = / sbindir = $(exec_prefix)/sbin @@ -19,7 +21,7 @@ MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 \ iscsiuio/docs/iscsiuio.8 doc/iscsi_fw_login.8 doc/iscsi-iname.8 \ - doc/iscsistart.8 + doc/iscsistart.8 doc/iscsi-gen-initiatorname.8 PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi-iname iscsiuio/src/unix/iscsiuio \ usr/iscsistart SCRIPTS = utils/iscsi_discovery utils/iscsi_fw_login utils/iscsi_offload \ @@ -61,7 +63,7 @@ all: user user: iscsiuio/Makefile - $(MAKE) -C libopeniscsiusr + $(MAKE) -C libopeniscsiusr SBINDIR=$(sbindir) $(MAKE) -C utils/sysdeps $(MAKE) -C utils/fwparam_ibft $(MAKE) -C usr @@ -114,6 +116,10 @@ install_udev_rules: $(INSTALL) -d $(DESTDIR)$(rulesdir) $(INSTALL) -m 644 $(RULESFILES) $(DESTDIR)/$(rulesdir) + for f in $(RULESFILES); do \ + p=$(DESTDIR)/$(rulesdir)/$${f##*/}; \ + $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \ + done install_systemd: $(INSTALL) -d $(DESTDIR)$(systemddir)/system @@ -121,10 +127,18 @@ $(INSTALL) -d $(DESTDIR)$(systemddir)/system-generators $(INSTALL) -m 755 utils/ibft-rule-generator \ $(DESTDIR)$(systemddir)/system-generators + for f in $(SYSTEMDFILES); do \ + p=$(DESTDIR)/$(systemddir)/system/$${f##*/}; \ + $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \ + done -install_programs: $(PROGRAMS) $(SCRIPTS) +install_programs: $(PROGRAMS) $(SCRIPTS) $(INSTALL) -d $(DESTDIR)$(sbindir) $(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir) + for f in $(SCRIPTS); do \ + p=$(DESTDIR)/$(sbindir)/$${f##*/}; \ + $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \ + done # ugh, auto-detection is evil # Gentoo maintains their own init.d stuff @@ -171,7 +185,7 @@ install_iname: if [ ! -f $(DESTDIR)/etc/iscsi/initiatorname.iscsi ]; then \ - echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \ + echo "InitiatorName=`$(DESTDIR)$(sbindir)/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \ echo "***************************************************" ; \ echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \ echo "To override edit $(DESTDIR)/etc/iscsi/initiatorname.iscsi" ; \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/README new/open-iscsi-2.1.6-suse/README --- old/open-iscsi-2.1.5-suse/README 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/README 2022-02-14 21:24:47.000000000 +0100 @@ -100,53 +100,20 @@ make make install -will install the iSCSI tools iscsiadm and iscsid to /sbin. - -For 2.6.14 - 2.6.34 the modules in the kernel dir can be built and installed -by running: - - make kernel - -When building those modules the kernel source found at - /lib/modules/`uname -r`/build - -will be used to compile the open-iscsi modules. To specify a different -kernel to build against, use: - make kernel KSRC=<kernel-src> - -or to use cross-compilation: - make kernel KSRC=<kernel-src> KARCH="ARCH=um" - -To compile on SUSE Linux you'll have to use - - make kernel KSRC=/usr/src/linux \ - KBUILD_OUTPUT=/usr/src/linux-obj/<arch>/<config> - -where <config> is the kernel configuration to use (eg. 'smp'). - -To install the kernel modules that were built, run: - - make install_kernel - -This will copy iscsi_tcp.ko, libiscsi_tcp.ko, libiscsi.ko and -scsi_transport_iscsi.ko to - /lib/modules/`uname -r`/kernel/drivers/scsi/ -overwriting existing iscsi modules. - -For Debian, be sure to install the linux-headers package that -corresponds to your kernel in order to compile the kernel modules -('aptitude install linux-headers-`uname -r`'). You may also wish to -run 'make -C kernel/ dpkg_divert' before installing kernel modules if -you run a Debian-provided kernel. This will use dpkg-divert(8) to -move the packaged kernel modules out of the way, and ensure that -future kernel upgrades will not overwrite them. - -Also, please be aware that the compatibility patches that enable these -iscsi modules to run on kernels older than 2.6.25 will not update the -ib_iser module; you may get warnings related to mismatched symbols on -this driver, in which case you'll be unable to load ib_iser and -open-iscsi simultaneously. - +will install the iSCSI tools iscsiadm and iscsid to /sbin, by default, +though that location can be overridden by passing in "sbindir", e.g. to +install in /usr/bin instead of /sbin: + + make sbindir="/usr/sbin" + +To build and install iscsiuio, use something like: + + cd iscsiuio + touch AUTHORS NEWS + autoreconf --install + ./configure [--sbindir="/usr/sbin"] + make + make install 4. Open-iSCSI daemon ==================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/doc/iscsi-gen-initiatorname.8 new/open-iscsi-2.1.6-suse/doc/iscsi-gen-initiatorname.8 --- old/open-iscsi-2.1.5-suse/doc/iscsi-gen-initiatorname.8 1970-01-01 01:00:00.000000000 +0100 +++ new/open-iscsi-2.1.6-suse/doc/iscsi-gen-initiatorname.8 2022-02-14 21:24:47.000000000 +0100 @@ -0,0 +1,36 @@ +.TH ISCSI_GEN_INITIATORNAME 8 "Dec 2021" "" "Linux Administrator's Manual" +.SH NAME +iscsi-gen-initiatorname \- smart iSCSI initiator name generation tool +.SH SYNOPSIS +.BI iscsi-gen-initiatorname +[OPTIONS] +.SH "DESCRIPTION" +.B iscsi-gen-initiatorname +generates a unique iSCSI node name on every invocation. If +iBFT is in use, the iBFT-registered initiator name will be used. +.P +If there is an existing initiator name, it will not be overwritten +unless the \fB-f\fP option is supplied. +.SH OPTIONS +.TP +.BI [-h] +Display a help message and exit. +.TP +.BI [-f] +Force overwrite of existing initiator name, if present. +.TP +.BI [-p] \fIIQN-PREFIX\fP +Use \fIIQN-PREFIX\fP as the prefix to the IQN generated, +instead of the default of \fBiqn.1996-04.de.suse:01\fP. +.SH FILES +.TP +/etc/iscsi/initiatorname.iscsi +The file containing the initiator name. Do not edit manually. +.SH "SEE ALSO" +.BR iscsi-iname (8) +.SH AUTHORS +Open-iSCSI project <http://www.open-iscsi.com/> +.br +Hannes Reinecke <h...@suse.de> +.br +Lee Duncan <ldun...@suse.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/etc/iscsid.conf new/open-iscsi-2.1.6-suse/etc/iscsid.conf --- old/open-iscsi-2.1.5-suse/etc/iscsid.conf 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/etc/iscsid.conf 2022-02-14 21:24:47.000000000 +0100 @@ -18,10 +18,13 @@ # maintainers. If you leave the iscsid daemon running all # the time then leave this attribute commented out. # -# Default for Fedora and RHEL. (uncomment to activate). +# Default for Fedora and RHEL. Uncomment to activate. # iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket # -# Default if you are not using systemd (uncomment to activate) +# Default for Debian and Ubuntu. Uncomment to activate. +# iscsid.startup = /bin/systemctl start iscsid.socket +# +# Default if you are not using systemd. Uncomment to activate. # iscsid.startup = /usr/bin/service start iscsid # Check for active mounts on devices reachable through a session @@ -38,10 +41,10 @@ # Startup settings #***************** -# To request that the iscsi initd scripts startup a session set to "automatic". +# To request that the iscsi service scripts startup a session, use "automatic": # node.startup = automatic # -# To manually startup the session set to "manual". The default is manual. +# To manually startup the session, use "manual". The default is manual. node.startup = manual # For "automatic" startup nodes, setting this to "Yes" will try logins on each @@ -57,9 +60,10 @@ # to CHAP. The default is None. #node.session.auth.authmethod = CHAP -# To configure which CHAP algorithms to enable set -# node.session.auth.chap_algs to a comma seperated list. -# The algorithms should be listen with most prefered first. +# To configure which CHAP algorithms to enable, set +# node.session.auth.chap_algs to a comma separated list. +# The algorithms should be listed in order of decreasing +# preference ??? in particular, with the most preferred algorithm first. # Valid values are MD5, SHA1, SHA256, and SHA3-256. # The default is MD5. #node.session.auth.chap_algs = SHA3-256,SHA256,SHA1,MD5 @@ -74,7 +78,7 @@ #node.session.auth.username_in = username_in #node.session.auth.password_in = password_in -# To enable CHAP authentication for a discovery session to the target +# To enable CHAP authentication for a discovery session to the target, # set discovery.sendtargets.auth.authmethod to CHAP. The default is None. #discovery.sendtargets.auth.authmethod = CHAP @@ -114,31 +118,36 @@ node.conn[0].timeo.logout_timeout = 15 # Time interval to wait for on connection before sending a ping. +# The value is in seconds and the default is 5 seconds. node.conn[0].timeo.noop_out_interval = 5 # To specify the time to wait for a Nop-out response before failing # the connection, edit this line. Failing the connection will # cause IO to be failed back to the SCSI layer. If using dm-multipath # this will cause the IO to be failed to the multipath layer. +# The value is in seconds and the default is 5 seconds. node.conn[0].timeo.noop_out_timeout = 5 -# To specify the time to wait for abort response before -# failing the operation and trying a logical unit reset edit the line. +# To specify the time to wait for an abort response before +# failing the operation and trying a logical unit reset, edit the line. # The value is in seconds and the default is 15 seconds. node.session.err_timeo.abort_timeout = 15 # To specify the time to wait for a logical unit response -# before failing the operation and trying session re-establishment +# before failing the operation and trying session re-establishment, # edit the line. # The value is in seconds and the default is 30 seconds. node.session.err_timeo.lu_reset_timeout = 30 # To specify the time to wait for a target response -# before failing the operation and trying session re-establishment +# before failing the operation and trying session re-establishment, # edit the line. # The value is in seconds and the default is 30 seconds. node.session.err_timeo.tgt_reset_timeout = 30 +# The value is in seconds and the default is 60 seconds. +node.session.err_timeo.host_reset_timeout = 60 + #****** # Retry @@ -146,7 +155,7 @@ # To specify the number of times iscsid should retry a login # if the login attempt fails due to the node.conn[0].timeo.login_timeout -# expiring modify the following line. Note that if the login fails +# expiring, modify the following line. Note that if the login fails # quickly (before node.conn[0].timeo.login_timeout fires) because the network # layer or the target returns an error, iscsid may retry the login more than # node.session.initial_login_retry_max times. @@ -160,8 +169,7 @@ # The default node.session.initial_login_retry_max is 8 and # node.conn[0].timeo.login_timeout is 15 so we have: # -# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max = -# 120 seconds +# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max = 120s # # Valid values are any integer value. This only # affects the initial login. Setting it to a high value can slow @@ -174,12 +182,12 @@ # session and device queue depth ################################ -# To control how many commands the session will queue set +# To control how many commands the session will queue, set # node.session.cmds_max to an integer between 2 and 2048 that is also # a power of 2. The default is 128. node.session.cmds_max = 128 -# To control the device's queue depth set node.session.queue_depth +# To control the device's queue depth, set node.session.queue_depth # to a value between 1 and 1024. The default is 32. node.session.queue_depth = 32 @@ -187,9 +195,9 @@ # MISC SYSTEM PERFORMANCE SETTINGS ################################## -# For software iscsi (iscsi_tcp) and iser (ib_iser) each session +# For software iscsi (iscsi_tcp) and iser (ib_iser), each session # has a thread used to transmit or queue data to the hardware. For -# cxgb3i you will get a thread per host. +# cxgb3i, you will get a thread per host. # # Setting the thread's priority to a lower value can lead to higher throughput # and lower latencies. The lowest value is -20. Setting the priority to @@ -197,8 +205,8 @@ # the iscsi or scsi threads dominate the use of the CPU then you may want # to set this value higher. # -# Note: For cxgb3i you must set all sessions to the same value, or the -# behavior is not defined. +# Note: For cxgb3i, you must set all sessions to the same value. +# Otherwise the behavior is not defined. # # The default value is -20. The setting must be between -20 and 20. node.session.xmit_thread_priority = -20 @@ -228,28 +236,28 @@ # To enable immediate data (i.e., the initiator sends unsolicited data # with the iSCSI command packet), uncomment the following line: # -# The default is Yes +# The default is Yes. node.session.iscsi.ImmediateData = Yes # To specify the maximum number of unsolicited data bytes the initiator # can send in an iSCSI PDU to a target, edit the following line. # # The value is the number of bytes in the range of 512 to (2^24-1) and -# the default is 262144 +# the default is 262144. node.session.iscsi.FirstBurstLength = 262144 # To specify the maximum SCSI payload that the initiator will negotiate # with the target for, edit the following line. # # The value is the number of bytes in the range of 512 to (2^24-1) and -# the defauls it 16776192 +# the defauls it 16776192. node.session.iscsi.MaxBurstLength = 16776192 # To specify the maximum number of data bytes the initiator can receive # in an iSCSI PDU from a target, edit the following line. # # The value is the number of bytes in the range of 512 to (2^24-1) and -# the default is 262144 +# the default is 262144. node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144 # To specify the maximum number of data bytes the initiator will send @@ -266,12 +274,12 @@ # following line. # # The value is the number of bytes in the range of 512 to (2^24-1) and -# the default is 32768 -# +# the default is 32768. discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 # To allow the targets to control the setting of the digest checking, -# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines: +# with the initiator requesting a preference of enabling the checking, +# uncomment one or both of the following lines: #node.conn[0].iscsi.HeaderDigest = CRC32C,None #node.conn[0].iscsi.DataDigest = CRC32C,None # @@ -295,41 +303,40 @@ # # For multipath configurations, you may want more than one session to be -# created on each iface record. If node.session.nr_sessions is greater +# created on each iface record. If node.session.nr_sessions is greater # than 1, performing a 'login' for that node will ensure that the # appropriate number of sessions is created. node.session.nr_sessions = 1 -# When iscsid starts up it recovers existing sessions, if possible. +# When iscsid starts up, it recovers existing sessions (if possible). # If the target for a session has gone away when this occurs, the # iscsid daemon normally tries to reestablish each session, # in succession, in the background, by trying again every two -# seconds, until all sessions are restored. This configuration +# seconds until all sessions are restored. This configuration # variable can limits the number of retries for each session. # For example, setting reopen_max=150 would mean that each session # recovery was limited to about five minutes. -# node.session.reopen_max = 0 #************ # Workarounds #************ -# Some targets like IET prefer after an initiator has sent a task -# management function like an ABORT TASK or LOGICAL UNIT RESET, that -# it does not respond to PDUs like R2Ts. To enable this behavior uncomment -# the following line (The default behavior is Yes): +# Some targets like IET prefer that an initiator does not respond to PDUs like +# R2Ts after it has sent a task management function like an ABORT TASK or a +# LOGICAL UNIT RESET. To adopt this behavior, uncomment the following line. +# The default is Yes. node.session.iscsi.FastAbort = Yes -# Some targets like Equalogic prefer that after an initiator has sent -# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that -# it continue to respond to R2Ts. To enable this uncomment this line +# Some targets like Equalogic prefer that an initiator continue to respond to +# R2Ts after it has sent a task management function like an ABORT TASK or a +# LOGICAL UNIT RESET. To adopt this behavior, uncomment the following line. # node.session.iscsi.FastAbort = No -# To prevent doing automatic scans that would add unwanted luns to the system +# To prevent doing automatic scans that would add unwanted luns to the system, # we can disable them and have sessions only do manually requested scans. # Automatic scans are performed on startup, on login, and on AEN/AER reception -# on devices supporting it. For HW drivers all sessions will use the value -# defined in the configuration file. This configuration option is independent -# of scsi_mod scan parameter. (The default behavior is auto): +# on devices supporting it. For HW drivers, all sessions will use the value +# defined in the configuration file. This configuration option is independent +# of the scsi_mod.scan parameter. The default is auto. node.session.scan = auto diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/etc/systemd/iscsi-init.service new/open-iscsi-2.1.6-suse/etc/systemd/iscsi-init.service --- old/open-iscsi-2.1.5-suse/etc/systemd/iscsi-init.service 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/etc/systemd/iscsi-init.service 2022-02-14 21:24:47.000000000 +0100 @@ -1,8 +1,10 @@ [Unit] Description=One time configuration for iscsid.service ConditionPathExists=!/etc/iscsi/initiatorname.iscsi +DefaultDependencies=no +After=root.mount [Service] Type=oneshot RemainAfterExit=no -ExecStart=/sbin/iscsi-gen-initiatorname +ExecStart=@SBINDIR@/iscsi-gen-initiatorname diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/etc/systemd/iscsi.service new/open-iscsi-2.1.6-suse/etc/systemd/iscsi.service --- old/open-iscsi-2.1.5-suse/etc/systemd/iscsi.service 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/etc/systemd/iscsi.service 2022-02-14 21:24:47.000000000 +0100 @@ -8,11 +8,11 @@ [Service] Type=oneshot -ExecStart=/sbin/iscsiadm -m node --loginall=automatic -W -ExecStart=/sbin/iscsiadm -m node --loginall=onboot -W -ExecStart=/sbin/iscsiadm -m fw -l -W -ExecStop=/sbin/iscsiadm -m node --logoutall=automatic -ExecStop=/sbin/iscsiadm -m node --logoutall=manual +ExecStart=@SBINDIR@/iscsiadm -m node --loginall=automatic -W +ExecStart=@SBINDIR@/iscsiadm -m node --loginall=onboot -W +ExecStart=@SBINDIR@/iscsiadm -m fw -l -W +ExecStop=@SBINDIR@/iscsiadm -m node --logoutall=automatic +ExecStop=@SBINDIR@/iscsiadm -m node --logoutall=manual SuccessExitStatus=21 15 RemainAfterExit=true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/etc/systemd/iscsid.service new/open-iscsi-2.1.6-suse/etc/systemd/iscsid.service --- old/open-iscsi-2.1.5-suse/etc/systemd/iscsid.service 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/etc/systemd/iscsid.service 2022-02-14 21:24:47.000000000 +0100 @@ -10,7 +10,7 @@ [Service] Type=notify NotifyAccess=main -ExecStart=/sbin/iscsid -f +ExecStart=@SBINDIR@/iscsid -f KillMode=mixed Restart=on-failure diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/etc/systemd/iscsiuio.service new/open-iscsi-2.1.6-suse/etc/systemd/iscsiuio.service --- old/open-iscsi-2.1.5-suse/etc/systemd/iscsiuio.service 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/etc/systemd/iscsiuio.service 2022-02-14 21:24:47.000000000 +0100 @@ -12,7 +12,7 @@ [Service] Type=notify NotifyAccess=main -ExecStart=/sbin/iscsiuio -f +ExecStart=@SBINDIR@/iscsiuio -f KillMode=mixed Restart=on-failure diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/include/iscsi_err.h new/open-iscsi-2.1.6-suse/include/iscsi_err.h --- old/open-iscsi-2.1.5-suse/include/iscsi_err.h 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/include/iscsi_err.h 2022-02-14 21:24:47.000000000 +0100 @@ -70,6 +70,8 @@ ISCSI_ERR_CHILD_TERMINATED = 31, /* session likely not connected */ ISCSI_ERR_SESSION_NOT_CONNECTED = 32, + /* iscsid request timed out */ + ISCSI_ERR_REQ_TIMEDOUT = 33, /* Always last. Indicates end of error code space */ ISCSI_MAX_ERR_VAL, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/libopeniscsiusr/Makefile new/open-iscsi-2.1.6-suse/libopeniscsiusr/Makefile --- old/open-iscsi-2.1.5-suse/libopeniscsiusr/Makefile 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/libopeniscsiusr/Makefile 2022-02-14 21:24:47.000000000 +0100 @@ -11,6 +11,8 @@ DESTDIR ?= prefix ?= /usr INSTALL ?= install +exec_prefix = / +sbindir = $(exec_prefix)/sbin ifndef LIB_DIR ifeq ($(shell test -d /lib64 && echo 1),1) @@ -25,6 +27,7 @@ MAN_DIR ?= $(prefix)/share/man PKG_CONFIG = /usr/bin/pkg-config +SED = /usr/bin/sed LIBISCSI_USR_DIR=$(TOPDIR)/libopeniscsiusr @@ -48,6 +51,7 @@ CFLAGS ?= -O2 -g CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod) +CFLAGS += -DSBINDIR=\"$(sbindir)\" LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/libopeniscsiusr/idbm.c new/open-iscsi-2.1.6-suse/libopeniscsiusr/idbm.c --- old/open-iscsi-2.1.5-suse/libopeniscsiusr/idbm.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/libopeniscsiusr/idbm.c 2022-02-14 21:24:47.000000000 +0100 @@ -996,7 +996,7 @@ /* use the interface name passed in, if any */ if (iface_name) - strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN); + strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN-1); /* * Note: because we do not add the iface.iscsi_ifacename to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/libopeniscsiusr/iface.c new/open-iscsi-2.1.6-suse/libopeniscsiusr/iface.c --- old/open-iscsi-2.1.5-suse/libopeniscsiusr/iface.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/libopeniscsiusr/iface.c 2022-02-14 21:24:47.000000000 +0100 @@ -44,7 +44,10 @@ #include "idbm.h" #include "default.h" -#define ISCSIUIO_PATH "/sbin/iscsiuio" +#ifndef SBINDIR +#define SBINDIR "/sbin" +#endif +#define ISCSIUIO_PATH SBINDIR "/iscsiuio" struct _iscsi_net_drv { const char *net_driver_name; // Ethernet driver. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/libopeniscsiusr/sysfs.c new/open-iscsi-2.1.6-suse/libopeniscsiusr/sysfs.c --- old/open-iscsi-2.1.5-suse/libopeniscsiusr/sysfs.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/libopeniscsiusr/sysfs.c 2022-02-14 21:24:47.000000000 +0100 @@ -240,7 +240,7 @@ errno_save = sysfs_read_file(file_path, buff, _INT32_STR_MAX_LEN); if (errno_save != 0) { - if (errno_save == ENOENT) { + if (errno_save == ENOENT || errno_save == EINVAL) { if (! ignore_error) { rc = LIBISCSI_ERR_SYSFS_LOOKUP; _error(ctx, "Failed to read '%s': " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/libopeniscsiusr/version.h new/open-iscsi-2.1.6-suse/libopeniscsiusr/version.h --- old/open-iscsi-2.1.5-suse/libopeniscsiusr/version.h 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/libopeniscsiusr/version.h 2022-02-14 21:24:47.000000000 +0100 @@ -25,6 +25,6 @@ * This may not be the same value as the kernel versions because * some other maintainer could merge a patch without going through us */ -#define ISCSI_VERSION_STR "2.1.5" +#define ISCSI_VERSION_STR "2.1.6" #endif /* End of __ISCSI_OPEN_USR_VERSION_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/actor.c new/open-iscsi-2.1.6-suse/usr/actor.c --- old/open-iscsi-2.1.5-suse/usr/actor.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/actor.c 2022-02-14 21:24:47.000000000 +0100 @@ -43,8 +43,12 @@ ((int64_t)(b) - (int64_t)(a) < 0) void -actor_init(actor_t *thread, void (*callback)(void *), void *data) +__actor_init(actor_t *thread, void (*callback)(void *), void *data) { + if (thread->state != ACTOR_INVALID) + log_error("bug:thread %p:%s has already been initialized", + thread, thread->name); + INIT_LIST_HEAD(&thread->list); thread->state = ACTOR_NOTSCHEDULED; thread->callback = callback; @@ -54,7 +58,8 @@ void actor_delete(actor_t *thread) { - log_debug(7, "thread %08lx delete: state %d", (long)thread, + log_debug(7, "thread %p:%s delete: state %d", + thread, thread->name, thread->state); switch(thread->state) { case ACTOR_WAITING: @@ -62,7 +67,8 @@ /* priority: low */ /* fallthrough */ case ACTOR_SCHEDULED: - log_debug(1, "deleting a scheduled/waiting thread!"); + log_debug(1, "deleting a scheduled/waiting thread %p:%s!", + thread, thread->name); list_del_init(&thread->list); if (list_empty(&pend_list)) { log_debug(7, "nothing left on pend_list, deactivating alarm"); @@ -93,10 +99,10 @@ /* insert new entry in sort order */ list_for_each_entry(next_thread, &pend_list, list) { if (time_after(next_thread->ttschedule, thread->ttschedule)) { - log_debug(7, "next thread %p due %lld", next_thread, - (long long)next_thread->ttschedule); - log_debug(7, "new thread %p is before (%lld), inserting", thread, - (long long)thread->ttschedule); + log_debug(7, "next thread %p:%s due %lld", next_thread, + next_thread->name, (long long)next_thread->ttschedule); + log_debug(7, "new thread %p:%s is before (%lld), inserting", + thread, next_thread->name, (long long)thread->ttschedule); /* insert new thread before the next thread */ __list_add(&thread->list, next_thread->list.prev, &next_thread->list); @@ -105,14 +111,14 @@ } if (orig_head) { - log_debug(7, "last thread %p due %lld", next_thread, - (long long)next_thread->ttschedule); - log_debug(7, "new thread %p is after (%lld), inserting at tail", thread, - (long long)thread->ttschedule); + log_debug(7, "last thread %p:%s due %lld", next_thread, + next_thread->name, (long long)next_thread->ttschedule); + log_debug(7, "new thread %p:%s is after (%lld), inserting at tail", + thread, thread->name, (long long)thread->ttschedule); } else - log_debug(7, "new thread %p due %lld is first item on pend_list", thread, - (long long)thread->ttschedule); + log_debug(7, "new thread %p:%s due %lld is first item on pend_list", + thread, thread->name, (long long)thread->ttschedule); /* Not before any existing entries */ list_add_tail(&thread->list, &pend_list); @@ -140,12 +146,13 @@ current_time = tv.tv_sec; - log_debug(7, "thread %p schedule: delay %u state %d", - thread, delay_secs, thread->state); + log_debug(7, "thread %p:%s schedule: delay %u state %d", + thread, thread->name, delay_secs, thread->state); switch(thread->state) { case ACTOR_WAITING: - log_error("rescheduling a waiting thread!"); + log_error("rescheduling a waiting thread %p:%s !", + thread, thread->name); list_del(&thread->list); /* fall-through */ case ACTOR_NOTSCHEDULED: @@ -168,8 +175,9 @@ // don't do anything break; case ACTOR_INVALID: - log_error("BUG: Trying to schedule a thread that has not been " - "setup. Ignoring sched."); + log_error("BUG: Trying to schedule a thread %p" + "that has not been setup. Ignoring sched.", + thread); break; } @@ -188,10 +196,10 @@ } void -actor_timer(actor_t *thread, uint32_t timeout_secs, void (*callback)(void *), +__actor_timer(actor_t *thread, uint32_t timeout_secs, void (*callback)(void *), void *data) { - actor_init(thread, callback, data); + __actor_init(thread, callback, data); actor_schedule_private(thread, timeout_secs, 0); } @@ -238,8 +246,8 @@ list_for_each_entry_safe(thread, tmp, &pend_list, list) { uint64_t time_left = actor_time_left(thread, current_time); if (time_left) { - log_debug(7, "thread %08lx due %" PRIu64 ", wait %" PRIu64 " more", - (long)thread, + log_debug(7, "thread %p:%s due %" PRIu64 ", wait %" PRIu64 " more", + thread, thread->name, (uint64_t)thread->ttschedule, time_left); alarm(time_left); @@ -249,17 +257,17 @@ /* This entry can be run now */ list_del_init(&thread->list); - log_debug(2, "thread %08lx was scheduled for " + log_debug(2, "thread %p:%s was scheduled for " "%" PRIu64 ", curtime %" PRIu64 " q_forw %p " "&pend_list %p", - (long)thread, (uint64_t)thread->ttschedule, + thread, thread->name, (uint64_t)thread->ttschedule, current_time, pend_list.next, &pend_list); list_add_tail(&thread->list, &ready_list); assert(thread->state == ACTOR_WAITING); thread->state = ACTOR_SCHEDULED; - log_debug(7, "thread %08lx now in ready_list", - (long)thread); + log_debug(7, "thread %p:%s now in ready_list", + thread, thread->name); } /* Disable alarm if nothing else pending */ @@ -274,13 +282,15 @@ list_del_init(&thread->list); if (thread->state != ACTOR_SCHEDULED) - log_error("ready_list: thread state corrupted! " + log_error("ready_list: thread %p:%s state corrupted! " "Thread with state %d in actor list.", + thread, thread->name, thread->state); thread->state = ACTOR_NOTSCHEDULED; - log_debug(7, "exec thread %08lx callback", (long)thread); + log_debug(7, "exec thread %p:%s", + thread, thread->name); thread->callback(thread->data); - log_debug(7, "thread %08lx done", (long)thread); + log_debug(7, "thread %p:%s done", thread, thread->name); } poll_in_progress = 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/actor.h new/open-iscsi-2.1.6-suse/usr/actor.h --- old/open-iscsi-2.1.5-suse/usr/actor.h 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/actor.h 2022-02-14 21:24:47.000000000 +0100 @@ -19,9 +19,12 @@ #ifndef ACTOR_H #define ACTOR_H +#include <stdio.h> #include "types.h" #include "list.h" +#define ACTOR_NAME_LEN 128 + typedef enum actor_state_e { ACTOR_INVALID, ACTOR_WAITING, @@ -30,6 +33,7 @@ } actor_state_e; typedef struct actor { + char name[ACTOR_NAME_LEN]; struct list_head list; actor_state_e state; void *data; @@ -37,14 +41,26 @@ time_t ttschedule; } actor_t; -extern void actor_init(actor_t *thread, void (*callback)(void *), void * data); +extern void __actor_init(actor_t *thread, void (*callback)(void *), void * data); extern void actor_delete(actor_t *thread); extern void actor_schedule_head(actor_t *thread); extern void actor_schedule(actor_t *thread); -extern void actor_timer(actor_t *thread, uint32_t delay_secs, +extern void __actor_timer(actor_t *thread, uint32_t delay_secs, void (*callback)(void *), void *data); extern void actor_timer_mod(actor_t *thread, uint32_t new_delay_secs, void *data); extern void actor_poll(void); +#define actor_init(thread, callback, data) \ +do { \ + snprintf((thread)->name, ACTOR_NAME_LEN, #callback); \ + __actor_init(thread, callback, data); \ +} while (0) + +#define actor_timer(thread, timeout_secs, callback, data) \ +do { \ + snprintf((thread)->name, ACTOR_NAME_LEN, #callback); \ + __actor_timer(thread, timeout_secs, callback, data); \ +} while (0) + #endif /* ACTOR_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/auth.c new/open-iscsi-2.1.6-suse/usr/auth.c --- old/open-iscsi-2.1.5-suse/usr/auth.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/auth.c 2022-02-14 21:24:47.000000000 +0100 @@ -109,7 +109,7 @@ unsigned char verify_data[client->chap_challenge_len]; /* the expected credentials are in the session */ - if (session->username_in == NULL) { + if (session->username_in[0] == '\0') { log_error("failing authentication, no incoming username " "configured to authenticate target %s", session->target_name); @@ -122,7 +122,6 @@ } if ((session->password_in_length < 1) || - (session->password_in == NULL) || (session->password_in[0] == '\0')) { log_error("failing authentication, no incoming password " "configured to authenticate target %s", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/discovery.c new/open-iscsi-2.1.6-suse/usr/discovery.c --- old/open-iscsi-2.1.5-suse/usr/discovery.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/discovery.c 2022-02-14 21:24:47.000000000 +0100 @@ -623,7 +623,7 @@ /* if no address is provided, use the default */ if (text >= end) { - if (drec->address == NULL) { + if (drec->address[0] == '\0') { log_error("no default address known for target %s", name); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/initiator.c new/open-iscsi-2.1.6-suse/usr/initiator.c --- old/open-iscsi-2.1.5-suse/usr/initiator.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/initiator.c 2022-02-14 21:24:47.000000000 +0100 @@ -137,7 +137,8 @@ static void iscsi_ev_context_put(struct iscsi_ev_context *ev_context) { - log_debug(7, "put ev context %p", &ev_context->actor); + log_debug(7, "put ev context %p:%s", &ev_context->actor, + (&ev_context->actor)->name); ev_context->allocated = 0; } @@ -2012,6 +2013,10 @@ struct iscsi_transport *t; int err; + session = session_find_by_sid(sid); + if (session != NULL) + return ISCSI_ERR_SESS_EXISTS; + t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name); if (!t) return ISCSI_ERR_TRANS_NOT_FOUND; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/initiator_common.c new/open-iscsi-2.1.6-suse/usr/initiator_common.c --- old/open-iscsi-2.1.5-suse/usr/initiator_common.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/initiator_common.c 2022-02-14 21:24:47.000000000 +0100 @@ -273,12 +273,10 @@ static void print_param_value(enum iscsi_param param, void *value, int type) { - log_debug(3, "set operational parameter %d to:", param); - if (type == ISCSI_STRING) - log_debug(3, "%s", value ? (char *)value : "NULL"); + log_debug(3, "set operational parameter %d to %s", param, value ? (char *)value : "NULL"); else - log_debug(3, "%u", *(uint32_t *)value); + log_debug(3, "set operational parameter %d to %u", param, *(uint32_t *)value); } #define MAX_HOST_PARAMS 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/iscsi_err.c new/open-iscsi-2.1.6-suse/usr/iscsi_err.c --- old/open-iscsi-2.1.5-suse/usr/iscsi_err.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/iscsi_err.c 2022-02-14 21:24:47.000000000 +0100 @@ -57,6 +57,7 @@ /* 30 */ "unknown discovery type", /* 31 */ "child process terminated", /* 32 */ "target likely not connected", + /* 33 */ "iscsid request timed out", }; char *iscsi_err_to_str(int err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/iscsi_sysfs.c new/open-iscsi-2.1.6-suse/usr/iscsi_sysfs.c --- old/open-iscsi-2.1.5-suse/usr/iscsi_sysfs.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/iscsi_sysfs.c 2022-02-14 21:24:47.000000000 +0100 @@ -1416,8 +1416,8 @@ log_debug(7, "found targetname %s address %s pers address %s port %d " "pers port %d driver %s iface name %s ipaddress %s " "netdev %s hwaddress %s iname %s", - info->targetname, info->address ? info->address : "NA", - info->persistent_address ? info->persistent_address : "NA", + info->targetname, info->address[0] ? info->address : "NA", + info->persistent_address[0] ? info->persistent_address : "NA", info->port, info->persistent_port, info->iface.transport_name, info->iface.name, info->iface.ipaddress, info->iface.netdev, info->iface.hwaddress, @@ -1929,18 +1929,41 @@ void iscsi_sysfs_set_device_online(__attribute__((unused))void *data, int hostno, int target, int lun) { - char *write_buf = "running\n"; + char *write_buf = "running\n", *state; char id[NAME_SIZE]; int err; snprintf(id, sizeof(id), "%d:0:%d:%d", hostno, target, lun); log_debug(4, "online device %s", id); + state = sysfs_get_value(id, SCSI_SUBSYS, "state"); + if (!state) { + log_error("Could not read state for LUN %s\n", id); + goto set_state; + } + + if (!strcmp(state, "running")) + goto done; + /* + * The kernel can start to perform session level recovery cleanup + * any time after the conn start call, so we only want to change the + * state if we are in one of the offline states. + */ + if (strcmp(state, "offline") && strcmp(state, "transport-offline")) { + log_debug(4, "Dev not offline. Skip onlining %s", id); + goto done; + } + +set_state: err = sysfs_set_param(id, SCSI_SUBSYS, "state", write_buf, strlen(write_buf)); if (err && err != EINVAL) /* we should read the state */ log_error("Could not online LUN %d err %d.", lun, err); + +done: + if (state) + free(state); } void iscsi_sysfs_rescan_device(__attribute__((unused))void *data, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/iscsiadm.c new/open-iscsi-2.1.6-suse/usr/iscsiadm.c --- old/open-iscsi-2.1.5-suse/usr/iscsiadm.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/iscsiadm.c 2022-02-14 21:24:47.000000000 +0100 @@ -3599,6 +3599,9 @@ struct iscsi_session *se = NULL; bool wait = true; + /* enable stdout logging */ + log_init(program_name, 1024, log_do_log_std, NULL); + ctx = iscsi_context_new(); if (ctx == NULL) { log_error("No memory"); @@ -3616,8 +3619,6 @@ umask(0077); - /* enable stdout logging */ - log_init(program_name, 1024, log_do_log_std, NULL); sysfs_init(); optopt = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/iscsid.c new/open-iscsi-2.1.6-suse/usr/iscsid.c --- old/open-iscsi-2.1.5-suse/usr/iscsid.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/iscsid.c 2022-02-14 21:24:47.000000000 +0100 @@ -289,7 +289,10 @@ retries++; sleep(1); goto retry; + } else if (rc == ISCSI_ERR_SESS_EXISTS) { + log_debug(1, "sync session %d returned ISCSI_ERR_SESS_EXISTS", info->sid); } + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/iscsid_req.c new/open-iscsi-2.1.6-suse/usr/iscsid_req.c --- old/open-iscsi-2.1.5-suse/usr/iscsid_req.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/iscsid_req.c 2022-02-14 21:24:47.000000000 +0100 @@ -141,12 +141,7 @@ size_t len = sizeof(*rsp); int iscsi_err = ISCSI_ERR_ISCSID_COMM_ERR; int err; - int poll_wait = 0; - if (timeout == -1) { - timeout = ISCSID_REQ_TIMEOUT; - poll_wait = 1; - } while (len) { struct pollfd pfd; @@ -154,9 +149,7 @@ pfd.events = POLLIN; err = poll(&pfd, 1, timeout); if (!err) { - if (poll_wait) - continue; - return ISCSI_ERR_SESSION_NOT_CONNECTED; + return ISCSI_ERR_REQ_TIMEDOUT; } else if (err < 0) { if (errno == EINTR) continue; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/iscsistart.c new/open-iscsi-2.1.6-suse/usr/iscsistart.c --- old/open-iscsi-2.1.5-suse/usr/iscsistart.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/iscsistart.c 2022-02-14 21:24:47.000000000 +0100 @@ -241,26 +241,18 @@ /* * Need to handle race where iscsid proc is starting up while we are * trying to connect. Retry with exponential backoff, start from 50 ms. - * - * NOTE: another race condition can occur if the system is just coming - * up, where our login request will be sent, but the login response - * takes a while. In such a case, if we timeout and give up, the - * login response may still show up once we give up, in which case - * it seems to get iscsistart into a state where it cannot try to - * login again because it thinks there's already a session. So make - * sure our timeout is long enough, on each try, to give the response - * a chance to show up. The old value of 1 second was not enough, - * so we multiply that by 10, which seems reasonable for initial - * login. */ for (msec = 50; msec <= 15000; msec <<= 1) { - int tmo = ISCSID_REQ_TIMEOUT * 10; - - rc = iscsid_exec_req(&req, &rsp, 0, tmo); + /* + * Once our event loop is up then we want to wait for the login + * response. Either it logs in, we hit the login retries count, + * or this program crashes, so there no need for the response + * timeout. + */ + rc = iscsid_exec_req(&req, &rsp, 0, -1); if (rc == 0) { return rc; - } else if (rc == ISCSI_ERR_SESSION_NOT_CONNECTED || - rc == ISCSI_ERR_ISCSID_NOTCONN) { + } else if (rc == ISCSI_ERR_ISCSID_NOTCONN) { ts.tv_sec = msec / 1000; ts.tv_nsec = (msec % 1000) * 1000000L; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/login.c new/open-iscsi-2.1.6-suse/usr/login.c --- old/open-iscsi-2.1.5-suse/usr/login.c 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/login.c 2022-02-14 21:24:47.000000000 +0100 @@ -657,7 +657,7 @@ struct iscsi_acl *auth_client; iscsi_conn_t *conn = &session->conn[cid]; - auth_client = (session->auth_buffers && session->num_auth_buffers) ? + auth_client = (session->num_auth_buffers > 0) ? (struct iscsi_acl *)session->auth_buffers[0].address : NULL; end = text + ntoh24(login_rsp->dlength) + 1; @@ -1135,7 +1135,7 @@ struct iscsi_acl *auth_client; iscsi_conn_t *conn = &session->conn[cid]; - auth_client = (session->auth_buffers && session->num_auth_buffers) ? + auth_client = (session->num_auth_buffers > 0) ? (struct iscsi_acl *)session->auth_buffers[0].address : NULL; /* initialize the PDU header */ @@ -1170,7 +1170,7 @@ return 0; } - if ((session->target_name && session->target_name[0]) && + if ((session->target_name[0] != '\0') && (session->type == ISCSI_SESSION_TYPE_NORMAL)) { if (!iscsi_add_text(hdr, data, max_data_length, "TargetName", session->target_name)) @@ -1248,16 +1248,16 @@ return LOGIN_FAILED; } - if (session->username && + if ((session->username[0] != '\0') && (acl_set_user_name(auth_client, session->username) != - AUTH_STATUS_NO_ERROR)) { + AUTH_STATUS_NO_ERROR)) { log_error("Couldn't set username"); goto end; } - if (session->password && (acl_set_passwd(auth_client, - session->password, session->password_length) != - AUTH_STATUS_NO_ERROR)) { + if ((session->password[0] != '\0') && + (acl_set_passwd(auth_client, session->password, session->password_length) != + AUTH_STATUS_NO_ERROR)) { log_error("Couldn't set password"); goto end; } @@ -1366,7 +1366,7 @@ conn->current_stage = ISCSI_INITIAL_LOGIN_STAGE; conn->partial_response = 0; - if (session->auth_buffers && session->num_auth_buffers) { + if (session->num_auth_buffers > 0) { c->ret = check_for_authentication(session, c->auth_client); if (c->ret != LOGIN_OK) return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/usr/version.h new/open-iscsi-2.1.6-suse/usr/version.h --- old/open-iscsi-2.1.5-suse/usr/version.h 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/usr/version.h 2022-02-14 21:24:47.000000000 +0100 @@ -6,7 +6,7 @@ * This may not be the same value as the kernel versions because * some other maintainer could merge a patch without going through us */ -#define ISCSI_VERSION_STR "2.1.5" +#define ISCSI_VERSION_STR "2.1.6" #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/utils/50-iscsi-firmware-login.rules new/open-iscsi-2.1.6-suse/utils/50-iscsi-firmware-login.rules --- old/open-iscsi-2.1.5-suse/utils/50-iscsi-firmware-login.rules 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/utils/50-iscsi-firmware-login.rules 2022-02-14 21:24:47.000000000 +0100 @@ -12,4 +12,4 @@ # having it as one single line avoids those problems. # # DO NOT WRAP THIS LINE -SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="/sbin/iscsi_fw_login" +SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="@SBINDIR@/iscsi_fw_login" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/utils/iscsi-gen-initiatorname new/open-iscsi-2.1.6-suse/utils/iscsi-gen-initiatorname --- old/open-iscsi-2.1.5-suse/utils/iscsi-gen-initiatorname 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/utils/iscsi-gen-initiatorname 2022-02-14 21:24:47.000000000 +0100 @@ -1,42 +1,68 @@ #!/bin/bash # -# /sbin/iscsi-gen-initiatorname +# iscsi-gen-initiatorname # # Generate a default iSCSI Initiatorname for SUSE installations. # -# Copyright (c) 2011 Hannes Reinecke, SUSE Labs +# Copyright (c) 2021 Hannes Reinecke, SUSE Labs # This script is licensed under the GPL. # -if [ "$1" ] ; then - if [ "$1" = "-f" ] ; then - FORCE=1 - else - echo "Invalid option $1" - echo "Usage: $0 [-f]" - exit 1 - fi +NAME="$0" +INAME_FILE="/etc/iscsi/initiatorname.iscsi" +IQN_PREFIX="iqn.1996-04.de.suse:01" + +usage_and_exit() +{ + xit_val=$1 + + echo "Usage: $NAME [OPTIONS] -- generate an iSCSI initiatorname" + echo "Where OPTIONS are from:" + echo " -h print usage and exit" + echo " -f overwrite existing initiator name, if any" + echo " -p IQN-PRE set the prefix for the IQN generated (default $IQN_PREFIX)" + exit $xit_val +} + +while getopts "hfp:" o ; do + case "${o}" in + h) usage_and_exit 0 ;; + f) FORCE=1 ;; + p) IQN_PREFIX=${OPTARG} ;; + ?) usage_and_exit 1 ;; + esac +done +shift $(($OPTIND-1)) + +if [ "$#" -gt 0 ] ; then + echo "Invalid argument(s): $*" + usage_and_exit fi +# use the iBFT initiator name, if present if [ -d /sys/firmware/ibft/initiator ] ; then read iSCSI_INITIATOR_NAME < /sys/firmware/ibft/initiator/initiator-name fi -if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then +# if we have an iBFT initiator name and an initiator name +# file, they had better match, unless "force" is set +if [ -f $INAME_FILE -a -z "$FORCE" ] ; then if [ "$iSCSI_INITIATOR_NAME" ] ; then - eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d') + eval $(cat $INAME_FILE | sed -e '/^#/d') if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then echo "iSCSI Initiatorname from iBFT is different from the current setting." - echo "Please call '/sbin/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname." + echo "Please call '@SBINDIR@/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname." exit 1 fi fi fi +# if we have an initiator name from iBFT or from +# an existing initiator name file, use it if [ "$iSCSI_INITIATOR_NAME" ] ; then - cat << EOF >> /etc/iscsi/initiatorname.iscsi -## -## /etc/iscsi/iscsi.initiatorname + echo "##" > $INAME_FILE || exit 1 + echo "## $INAME_FILE" >> $INAME_FILE + cat << EOF >> $INAME_FILE ## ## iSCSI Initiatorname taken from iBFT BIOS tables. ## @@ -45,17 +71,19 @@ ## Any change here will not be reflected to the iBFT BIOS tables. ## If a different initiatorname is required please change the ## initiatorname in the BIOS setup and call -## /sbin/iscsi-gen-initiatorname -f +## @SBINDIR@/iscsi-gen-initiatorname -f ## to recreate an updated version of this file. ## -InitiatorName=$iSCSI_INITIATOR_NAME EOF + echo "InitiatorName=$iSCSI_INITIATOR_NAME" >> $INAME_FILE + chmod 0600 $INAME_FILE fi -if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then - cat << EOF >> /etc/iscsi/initiatorname.iscsi -## -## /etc/iscsi/iscsi.initiatorname +# if we still do not have an initiator name, create one +if [ ! -f $INAME_FILE ] ; then + echo "##" > $INAME_FILE || exit 1 + echo "## $INAME_FILE" >> $INAME_FILE + cat << EOF >> $INAME_FILE ## ## Default iSCSI Initiatorname. ## @@ -65,9 +93,9 @@ ## may reject this initiator. The InitiatorName must be unique ## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames. EOF - ISSUEDATE="1996-04" - INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01) - printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi - chmod 0600 /etc/iscsi/initiatorname.iscsi + # create a unique initiator name using iscsi-iname + INAME=$(@SBINDIR@/iscsi-iname -p "$IQN_PREFIX") + echo "InitiatorName=$INAME" >> $INAME_FILE + chmod 0600 $INAME_FILE fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.5-suse/utils/iscsi_fw_login new/open-iscsi-2.1.6-suse/utils/iscsi_fw_login --- old/open-iscsi-2.1.5-suse/utils/iscsi_fw_login 2021-09-09 00:33:40.000000000 +0200 +++ new/open-iscsi-2.1.6-suse/utils/iscsi_fw_login 2022-02-14 21:24:47.000000000 +0100 @@ -7,6 +7,6 @@ # ARGS="-m fw -l" -ISCSIADM="/sbin/iscsiadm" +ISCSIADM="@SBINDIR@/iscsiadm" $ISCSIADM $ARGS ++++++ open-iscsi-SUSE-latest.diff.bz2 ++++++ --- /var/tmp/diff_new_pack.r2ReYJ/_old 2022-02-17 00:29:56.645439365 +0100 +++ /var/tmp/diff_new_pack.r2ReYJ/_new 2022-02-17 00:29:56.649439364 +0100 @@ -1,366 +1,3 @@ -diff --git a/Makefile b/Makefile -index 4ccf706adcfd..94b7b3e95e6d 100644 ---- a/Makefile -+++ b/Makefile -@@ -6,6 +6,8 @@ - # that you want everything installed into. - DESTDIR ?= - -+SED = /usr/bin/sed -+ - prefix = /usr - exec_prefix = / - sbindir = $(exec_prefix)/sbin -@@ -61,7 +63,7 @@ endif - all: user - - user: iscsiuio/Makefile -- $(MAKE) -C libopeniscsiusr -+ $(MAKE) -C libopeniscsiusr SBINDIR=$(sbindir) - $(MAKE) -C utils/sysdeps - $(MAKE) -C utils/fwparam_ibft - $(MAKE) -C usr -@@ -114,6 +116,10 @@ install_user: install_programs install_doc install_etc \ - install_udev_rules: - $(INSTALL) -d $(DESTDIR)$(rulesdir) - $(INSTALL) -m 644 $(RULESFILES) $(DESTDIR)/$(rulesdir) -+ for f in $(RULESFILES); do \ -+ p=$(DESTDIR)/$(rulesdir)/$${f##*/}; \ -+ $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \ -+ done - - install_systemd: - $(INSTALL) -d $(DESTDIR)$(systemddir)/system -@@ -121,10 +127,18 @@ install_systemd: - $(INSTALL) -d $(DESTDIR)$(systemddir)/system-generators - $(INSTALL) -m 755 utils/ibft-rule-generator \ - $(DESTDIR)$(systemddir)/system-generators -+ for f in $(SYSTEMDFILES); do \ -+ p=$(DESTDIR)/$(systemddir)/system/$${f##*/}; \ -+ $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \ -+ done - --install_programs: $(PROGRAMS) $(SCRIPTS) -+install_programs: $(PROGRAMS) $(SCRIPTS) - $(INSTALL) -d $(DESTDIR)$(sbindir) - $(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir) -+ for f in $(SCRIPTS); do \ -+ p=$(DESTDIR)/$(sbindir)/$${f##*/}; \ -+ $(SED) -i -e 's:@SBINDIR@:$(sbindir):' $$p; \ -+ done - - # ugh, auto-detection is evil - # Gentoo maintains their own init.d stuff -@@ -171,7 +185,7 @@ install_doc: $(MANPAGES) - - install_iname: - if [ ! -f $(DESTDIR)/etc/iscsi/initiatorname.iscsi ]; then \ -- echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \ -+ echo "InitiatorName=`$(DESTDIR)$(sbindir)/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \ - echo "***************************************************" ; \ - echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \ - echo "To override edit $(DESTDIR)/etc/iscsi/initiatorname.iscsi" ; \ -diff --git a/README b/README -index 508c9d7b2bfe..3e0459a38f47 100644 ---- a/README -+++ b/README -@@ -100,53 +100,20 @@ By default the kernel's iSCSI modules will be used. Running: - make - make install - --will install the iSCSI tools iscsiadm and iscsid to /sbin. -+will install the iSCSI tools iscsiadm and iscsid to /sbin, by default, -+though that location can be overridden by passing in "sbindir", e.g. to -+install in /usr/bin instead of /sbin: - --For 2.6.14 - 2.6.34 the modules in the kernel dir can be built and installed --by running: -+ make sbindir="/usr/sbin" - -- make kernel -- --When building those modules the kernel source found at -- /lib/modules/`uname -r`/build -- --will be used to compile the open-iscsi modules. To specify a different --kernel to build against, use: -- make kernel KSRC=<kernel-src> -- --or to use cross-compilation: -- make kernel KSRC=<kernel-src> KARCH="ARCH=um" -- --To compile on SUSE Linux you'll have to use -- -- make kernel KSRC=/usr/src/linux \ -- KBUILD_OUTPUT=/usr/src/linux-obj/<arch>/<config> -- --where <config> is the kernel configuration to use (eg. 'smp'). -- --To install the kernel modules that were built, run: -- -- make install_kernel -- --This will copy iscsi_tcp.ko, libiscsi_tcp.ko, libiscsi.ko and --scsi_transport_iscsi.ko to -- /lib/modules/`uname -r`/kernel/drivers/scsi/ --overwriting existing iscsi modules. -- --For Debian, be sure to install the linux-headers package that --corresponds to your kernel in order to compile the kernel modules --('aptitude install linux-headers-`uname -r`'). You may also wish to --run 'make -C kernel/ dpkg_divert' before installing kernel modules if --you run a Debian-provided kernel. This will use dpkg-divert(8) to --move the packaged kernel modules out of the way, and ensure that --future kernel upgrades will not overwrite them. -- --Also, please be aware that the compatibility patches that enable these --iscsi modules to run on kernels older than 2.6.25 will not update the --ib_iser module; you may get warnings related to mismatched symbols on --this driver, in which case you'll be unable to load ib_iser and --open-iscsi simultaneously. -+To build and install iscsiuio, use something like: - -+ cd iscsiuio -+ touch AUTHORS NEWS -+ autoreconf --install -+ ./configure [--sbindir="/usr/sbin"] -+ make -+ make install - - 4. Open-iSCSI daemon - ==================== -diff --git a/etc/systemd/iscsi-init.service b/etc/systemd/iscsi-init.service -index 34557bfa8a71..84983fabad56 100644 ---- a/etc/systemd/iscsi-init.service -+++ b/etc/systemd/iscsi-init.service -@@ -1,8 +1,10 @@ - [Unit] - Description=One time configuration for iscsid.service - ConditionPathExists=!/etc/iscsi/initiatorname.iscsi -+DefaultDependencies=no -+After=root.mount - - [Service] - Type=oneshot - RemainAfterExit=no --ExecStart=/sbin/iscsi-gen-initiatorname -+ExecStart=@SBINDIR@/iscsi-gen-initiatorname -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index 3d468b9f1ad7..8d30740d1b4c 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -8,11 +8,11 @@ Wants=network-online.target - - [Service] - Type=oneshot --ExecStart=/sbin/iscsiadm -m node --loginall=automatic -W --ExecStart=/sbin/iscsiadm -m node --loginall=onboot -W --ExecStart=/sbin/iscsiadm -m fw -l -W --ExecStop=/sbin/iscsiadm -m node --logoutall=automatic --ExecStop=/sbin/iscsiadm -m node --logoutall=manual -+ExecStart=@SBINDIR@/iscsiadm -m node --loginall=automatic -W -+ExecStart=@SBINDIR@/iscsiadm -m node --loginall=onboot -W -+ExecStart=@SBINDIR@/iscsiadm -m fw -l -W -+ExecStop=@SBINDIR@/iscsiadm -m node --logoutall=automatic -+ExecStop=@SBINDIR@/iscsiadm -m node --logoutall=manual - SuccessExitStatus=21 15 - RemainAfterExit=true - -diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service -index 3fd7dd35fcdc..e2a50d371ebe 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service -@@ -10,7 +10,7 @@ Requires=iscsi-init.service - [Service] - Type=notify - NotifyAccess=main --ExecStart=/sbin/iscsid -f -+ExecStart=@SBINDIR@/iscsid -f - KillMode=mixed - Restart=on-failure - -diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service -index 42daeb90a832..efbfa4fdeb53 100644 ---- a/etc/systemd/iscsiuio.service -+++ b/etc/systemd/iscsiuio.service -@@ -12,7 +12,7 @@ Wants=remote-fs-pre.target - [Service] - Type=notify - NotifyAccess=main --ExecStart=/sbin/iscsiuio -f -+ExecStart=@SBINDIR@/iscsiuio -f - KillMode=mixed - Restart=on-failure - -diff --git a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile -index a9e461adda02..c921bfb6fe5f 100644 ---- a/libopeniscsiusr/Makefile -+++ b/libopeniscsiusr/Makefile -@@ -11,6 +11,8 @@ endif - DESTDIR ?= - prefix ?= /usr - INSTALL ?= install -+exec_prefix = / -+sbindir = $(exec_prefix)/sbin - - ifndef LIB_DIR - ifeq ($(shell test -d /lib64 && echo 1),1) -@@ -25,6 +27,7 @@ PKGCONF_DIR ?= $(LIB_DIR)/pkgconfig - MAN_DIR ?= $(prefix)/share/man - - PKG_CONFIG = /usr/bin/pkg-config -+SED = /usr/bin/sed - - LIBISCSI_USR_DIR=$(TOPDIR)/libopeniscsiusr - -@@ -48,6 +51,7 @@ OBJS = context.o misc.o session.o sysfs.o iface.o idbm.o node.o default.o - CFLAGS ?= -O2 -g - CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC - CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod) -+CFLAGS += -DSBINDIR=\"$(sbindir)\" - - LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod) - -diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c -index b2524ed5f46b..6f57e457d78c 100644 ---- a/libopeniscsiusr/idbm.c -+++ b/libopeniscsiusr/idbm.c -@@ -996,7 +996,7 @@ static void _idbm_node_rec_link(struct iscsi_node *node, struct idbm_rec *recs, - - /* use the interface name passed in, if any */ - if (iface_name) -- strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN); -+ strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN-1); - - /* - * Note: because we do not add the iface.iscsi_ifacename to -diff --git a/libopeniscsiusr/iface.c b/libopeniscsiusr/iface.c -index 63f9c61f7529..006b188b33f8 100644 ---- a/libopeniscsiusr/iface.c -+++ b/libopeniscsiusr/iface.c -@@ -44,7 +44,10 @@ - #include "idbm.h" - #include "default.h" - --#define ISCSIUIO_PATH "/sbin/iscsiuio" -+#ifndef SBINDIR -+#define SBINDIR "/sbin" -+#endif -+#define ISCSIUIO_PATH SBINDIR "/iscsiuio" - - struct _iscsi_net_drv { - const char *net_driver_name; // Ethernet driver. -diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c -index abefde22e925..7bb834a8b8c1 100644 ---- a/usr/iscsi_sysfs.c -+++ b/usr/iscsi_sysfs.c -@@ -1929,18 +1929,41 @@ void iscsi_sysfs_set_queue_depth(void *data, int hostno, int target, int lun) - void iscsi_sysfs_set_device_online(__attribute__((unused))void *data, - int hostno, int target, int lun) - { -- char *write_buf = "running\n"; -+ char *write_buf = "running\n", *state; - char id[NAME_SIZE]; - int err; - - snprintf(id, sizeof(id), "%d:0:%d:%d", hostno, target, lun); - log_debug(4, "online device %s", id); - -+ state = sysfs_get_value(id, SCSI_SUBSYS, "state"); -+ if (!state) { -+ log_error("Could not read state for LUN %s\n", id); -+ goto set_state; -+ } -+ -+ if (!strcmp(state, "running")) -+ goto done; -+ /* -+ * The kernel can start to perform session level recovery cleanup -+ * any time after the conn start call, so we only want to change the -+ * state if we are in one of the offline states. -+ */ -+ if (strcmp(state, "offline") && strcmp(state, "transport-offline")) { -+ log_debug(4, "Dev not offline. Skip onlining %s", id); -+ goto done; -+ } -+ -+set_state: - err = sysfs_set_param(id, SCSI_SUBSYS, "state", write_buf, - strlen(write_buf)); - if (err && err != EINVAL) - /* we should read the state */ - log_error("Could not online LUN %d err %d.", lun, err); -+ -+done: -+ if (state) -+ free(state); - } - - void iscsi_sysfs_rescan_device(__attribute__((unused))void *data, -diff --git a/utils/50-iscsi-firmware-login.rules b/utils/50-iscsi-firmware-login.rules -index 47b3cf96f38b..9fa1e7df0bed 100644 ---- a/utils/50-iscsi-firmware-login.rules -+++ b/utils/50-iscsi-firmware-login.rules -@@ -12,4 +12,4 @@ - # having it as one single line avoids those problems. - # - # DO NOT WRAP THIS LINE --SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="/sbin/iscsi_fw_login" -+SUBSYSTEM=="iscsi_boot*", ACTION=="add", DEVPATH=="*/target*", RUN+="@SBINDIR@/iscsi_fw_login" -diff --git a/utils/iscsi-gen-initiatorname b/utils/iscsi-gen-initiatorname -index 88bd43b38f4e..3e30465facb6 100644 ---- a/utils/iscsi-gen-initiatorname -+++ b/utils/iscsi-gen-initiatorname -@@ -1,10 +1,10 @@ - #!/bin/bash - # --# /sbin/iscsi-gen-initiatorname -+# iscsi-gen-initiatorname - # - # Generate a default iSCSI Initiatorname for SUSE installations. - # --# Copyright (c) 2011 Hannes Reinecke, SUSE Labs -+# Copyright (c) 2021 Hannes Reinecke, SUSE Labs - # This script is licensed under the GPL. - # - -@@ -27,7 +27,7 @@ if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then - eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d') - if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then - echo "iSCSI Initiatorname from iBFT is different from the current setting." -- echo "Please call '/sbin/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname." -+ echo "Please call '@SBINDIR@/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname." - exit 1 - fi - fi -@@ -45,7 +45,7 @@ if [ "$iSCSI_INITIATOR_NAME" ] ; then - ## Any change here will not be reflected to the iBFT BIOS tables. - ## If a different initiatorname is required please change the - ## initiatorname in the BIOS setup and call --## /sbin/iscsi-gen-initiatorname -f -+## @SBINDIR@/iscsi-gen-initiatorname -f - ## to recreate an updated version of this file. - ## - InitiatorName=$iSCSI_INITIATOR_NAME -@@ -66,7 +66,7 @@ if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then - ## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames. - EOF - ISSUEDATE="1996-04" -- INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01) -+ INAME=$(@SBINDIR@/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01) - printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi - chmod 0600 /etc/iscsi/initiatorname.iscsi - fi -diff --git a/utils/iscsi_fw_login b/utils/iscsi_fw_login -index 1312ed372cef..aae9e4c00c2d 100755 ---- a/utils/iscsi_fw_login -+++ b/utils/iscsi_fw_login -@@ -7,6 +7,6 @@ - # - - ARGS="-m fw -l" --ISCSIADM="/sbin/iscsiadm" -+ISCSIADM="@SBINDIR@/iscsiadm" - - $ISCSIADM $ARGS + +(No newline at EOF)