commit open-iscsi for openSUSE:Factory
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 2024-10-03 18:00:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/open-iscsi (Old) and /work/SRC/openSUSE:Factory/.open-iscsi.new.19354 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "open-iscsi" Thu Oct 3 18:00:34 2024 rev:133 rq:1205287 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/open-iscsi/open-iscsi.changes 2023-12-26 18:27:12.817279758 +0100 +++ /work/SRC/openSUSE:Factory/.open-iscsi.new.19354/open-iscsi.changes 2024-10-03 18:00:47.311207566 +0200 @@ -1,0 +2,24 @@ +Mon Sep 30 19:25:24 UTC 2024 - lduncan@suse.com + +- Update to version 2.1.10.suse+51.fea0fde82ed1: + * Incudes upstream version 2.1.10 plus some fixes + * Fix firmware targets startup to always be "onboot" (#482) + (bsc#1228084) + * Change a discovery function to void return type (#481) + * Fix gcc issues (#480) + * Bugfix read specific sysfs value "off" of session attribute (#466) + * Fix bug where abort_tmo read failures were ignored. (#467) + * grammar nitpicks (#464) + * Fix memory leak in iscsi_check_session_use_count (#465) + * improve the comments in idbm_lock() (#458) + * Make it visible when memory allocation failure (#457) + * Better handle multiple iscsiadm commands (#453) + * iscsiadm: allow hostnames in node-mode commands (#451) + * Modify how workqueue priority is set (#445) + * Fix authmethod check by printing a warning message when CHAP used and authmethod=None (#443) + * iscsid: Rescan devices on relogin (#444) + * Adds missing characters in README. (#440) + * Turn off iSCSI NOP-Outs, by default. + * fix: add usr/iscsid_req.h missinig underline (#431) (#436) + +------------------------------------------------------------------- Old: ---- open-iscsi-2.1.9.suse+844.d557967bc9ae.tar.xz New: ---- open-iscsi-2.1.10.suse+52.9a4cb8fdee02.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ open-iscsi.spec ++++++ --- /var/tmp/diff_new_pack.xNkxlV/_old 2024-10-03 18:00:48.907274016 +0200 +++ /var/tmp/diff_new_pack.xNkxlV/_new 2024-10-03 18:00:48.911274182 +0200 @@ -1,7 +1,7 @@ # # spec file for package open-iscsi # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -46,13 +46,13 @@ %endif %define iscsi_minor_release 1 -%define iscsi_patch_release 9 +%define iscsi_patch_release 10 %define iscsi_patch_release_suse %{iscsi_patch_release}.suse -%define iscsi_service_tag 844.d557967bc9ae +%define iscsi_service_tag 52.9a4cb8fdee02 %define libname libopeniscsiusr0 %define libversion 0.2.0 Name: open-iscsi -Version: 2.1.9 +Version: 2.1.10 Release: 0 Summary: Linux iSCSI Software Initiator License: GPL-2.0-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.xNkxlV/_old 2024-10-03 18:00:49.111282509 +0200 +++ /var/tmp/diff_new_pack.xNkxlV/_new 2024-10-03 18:00:49.143283841 +0200 @@ -3,9 +3,9 @@ <param name="url">https://github.com/openSUSE/open-iscsi.git</param> <param name="scm">git</param> <param name="filename">open-iscsi</param> - <param name="version">d557967bc9ae</param> - <param name="versionformat">2.1.9.suse+@TAG_OFFSET@.%h</param> - <param name="match-tag">2.1.[0-9]</param> + <param name="version">fea0fde82ed1</param> + <param name="versionformat">2.1.10.suse+@TAG_OFFSET@.%h</param> + <param name="match-tag">2.1.[0-9]*</param> <param name="revision">openSUSE-Factory</param> <param name="changesgenerate">enable</param> <param name="exclude">.git</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.xNkxlV/_old 2024-10-03 18:00:49.271289171 +0200 +++ /var/tmp/diff_new_pack.xNkxlV/_new 2024-10-03 18:00:49.299290337 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/openSUSE/open-iscsi.git</param> - <param name="changesrevision">d557967bc9aeaa9aa4f62b443c0aec48a8e8e046</param></service></servicedata> + <param name="changesrevision">fea0fde82ed1f2974839501bf68121d9ad0fc4b5</param></service></servicedata> (No newline at EOF) ++++++ open-iscsi-2.1.9.suse+844.d557967bc9ae.tar.xz -> open-iscsi-2.1.10.suse+52.9a4cb8fdee02.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/Changelog new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/Changelog --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/Changelog 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/Changelog 2024-10-01 21:06:22.000000000 +0200 @@ -1,3 +1,38 @@ +-> open-iscsi-2.1.9 - open-iscsi-2.1.10 + +Chris Leech (1): + remove unicode symbol from iscsid.conf (#423) + +Christian Steinert (1): + Adds missing characters in README. (#440) + +Daniel Moulton (1): + Incorrect documentation for `iscsiadm -m session` print level (#432) + +Fabrice Fontaine (1): + usr/idbm.c: fix musl build (#426) + +Graham Inggs (1): + discoveryd: fix additional format overflow warnings (#425) + +Lee Duncan (9): + iscsiuio build: use correct new version (#422) + Iscsiuio fixes v2 (#427) + iscsiuio: manage threads better at shutdown (#428) + iscsiuio: update version to 0.7.8.8 (#429) + Stop using deprecated inet_aton and inet_ntoa (#435) + Fix authmethod check by printing a warning message when CHAP used and authmethod=None (#443) + Modify how workqueue priority is set (#445) + iscsiadm: allow hostnames in node-mode commands (#451) + Better handle multiple iscsiadm commands (#453) + +cooper.wu (1): + fix: add usr/iscsid_req.h missinig underline (#431) (#436) + +mikechristie (1): + iscsid: Rescan devices on relogin (#444) + + -> open-iscsi-2.1.8 - open-iscsi-2.1.9 Chris Leech (5): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/Makefile new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/Makefile --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/Makefile 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/Makefile 2024-10-01 21:06:22.000000000 +0200 @@ -7,7 +7,7 @@ DESTDIR ?= # our VERSION String -ISCSI_VERSION_STR ?= 2.1.9 +ISCSI_VERSION_STR ?= 2.1.10 prefix = /usr exec_prefix = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/README new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/README --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/README 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/README 2024-10-01 21:06:22.000000000 +0200 @@ -182,9 +182,9 @@ ==================== The iscsid daemon implements control path of iSCSI protocol, plus some -anagement facilities. For example, the daemon could be configured to -utomatically re-start discovery at startup, based on the contents of -ersistent iSCSI database (see next section). +management facilities. For example, the daemon could be configured to +automatically re-start discovery at startup, based on the contents of +persistent iSCSI database (see next section). For help, run: @@ -1603,12 +1603,14 @@ node.conn[0].timeo.noop_out_interval = X -Where X is in seconds and the default is 10 seconds. To control the -timeout for the NOP-Out the noop_out_timeout value can be used: +Where X is in seconds and the default is 0 seconds, which that NOP-outs +should be disabled. Upstream default is 5 seconds. + +o control the timeout for the NOP-Out the noop_out_timeout value can be used: node.conn[0].timeo.noop_out_timeout = X -Again X is in seconds and the default is 15 seconds. +Again X is in seconds and the default is 5 seconds. Normally for these values you can use: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/doc/iscsiadm.8.template new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/doc/iscsiadm.8.template --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/doc/iscsiadm.8.template 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/doc/iscsiadm.8.template 2024-10-01 21:06:22.000000000 +0200 @@ -186,12 +186,12 @@ .TP .B Home Directory The \fIhome directory\fR for open-iscsi is @HOMEDIR@. This is -where it keeps it's configuration file (\fIiscsid.conf\fR) and it's +where it keeps its configuration file (\fIiscsid.conf\fR) and its initiator name file (\fIinitiatorname.iscsi\fR). .TP .B Database Root Directory The \fIdatabase root directory\fR for open-iscsi is @DBROOT@. This -is where it keeps its flat database files, such as it's list of \fInode\fRs +is where it keeps its flat database files, such as its list of \fInode\fRs (see below). .SH OPTIONS .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/etc/iscsid.conf new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/etc/iscsid.conf --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/etc/iscsid.conf 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/etc/iscsid.conf 2024-10-01 21:06:22.000000000 +0200 @@ -64,6 +64,13 @@ # To enable CHAP authentication set node.session.auth.authmethod # to CHAP. The default is None. +# +# NOTE: currently this attribute is checked for validity but then +# ignored, so even if it is set to None, CHAP will be used if the +# credentials (username/password and possibly username_in/password_in) +# are set. This behavior is deprecated, and in the future CHAP will +# not be used if authmethod is set to None. +# #node.session.auth.authmethod = CHAP # To configure which CHAP algorithms to enable, set @@ -86,6 +93,9 @@ # To enable CHAP authentication for a discovery session to the target, # set discovery.sendtargets.auth.authmethod to CHAP. The default is None. +# +# See NOTE above for node.session.auth.authmethod being mostly ignored. +# #discovery.sendtargets.auth.authmethod = CHAP # To set a discovery session CHAP username and password for the initiator @@ -124,8 +134,9 @@ 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 +# The value is in seconds and the default is 0, which means +# do not send any NOOPs. Upstream default is 5 seconds. +node.conn[0].timeo.noop_out_interval = 0 # To specify the time to wait for a Nop-out response before failing # the connection, edit this line. Failing the connection will @@ -214,8 +225,21 @@ # 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 +# This is done by scanning /proc/PID/stat, and this doesn't work in +# newer kernels (6.* on), as the workqueue transmit thread can be +# passive, and not show in in the process table when not actively +# doing work. If the proper workqueue process is found, and the +# priority value is non-zero, then the priority of that process will +# be modified when a session is created. +# +# Note: as mentioned above, the default value is now zero, which means +# that we don't do anything to the transmit workqueue process priority, +# by default. If you wish to get the previous behavior, set this value +# to -20. In the future, this functionality will be removed, once this +# functionality is no longer needed or works. +# +# The default value is 0. The setting must be between -20 and 20. +# node.session.xmit_thread_priority = 0 #*************** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/libopeniscsiusr/idbm.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/libopeniscsiusr/idbm.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/libopeniscsiusr/idbm.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/libopeniscsiusr/idbm.c 2024-10-01 21:06:22.000000000 +0200 @@ -315,27 +315,41 @@ db = ctx->db; + /* if DB is already being used just increment count and return */ if (db->refs > 0) { db->refs++; return 0; } + /* DB is not being used -- ensure there is a lock dir */ if (access(LOCK_DIR, F_OK) != 0) { - if (mkdir(LOCK_DIR, 0770) != 0) { - _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno, - _strerror(errno, strerr_buff)); + if ((mkdir(LOCK_DIR, 0770) != 0) && (errno != EEXIST)) { + _error(ctx, "Could not open %s: %d: %s", LOCK_DIR, + errno, _strerror(errno, strerr_buff)); return LIBISCSI_ERR_IDBM; } } + /* create the lock file, if needed */ fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666); - if (fd >= 0) - close(fd); + if (fd < 0) { + _error(ctx, "Could not open/create lock file: %s", LOCK_FILE); + return LIBISCSI_ERR_IDBM; + } + close(fd); - for (i = 0; i < 3000; i++) { + /* + * try to create a link from the lock file to the + * lock "write" file, retrying everying 10 miliseconds + * for up to 30 seconds! + * + * XXX: very long -- should be configurable? + */ + for (i = 0; i < DB_LOCK_RETRIES; i++) { ret = link(LOCK_FILE, LOCK_WRITE_FILE); if (ret == 0) - break; + break; /* success */ + errno_save = errno; if (errno != EEXIST) { @@ -344,20 +358,27 @@ LOCK_WRITE_FILE, errno_save, _strerror(errno_save, strerr_buff)); return LIBISCSI_ERR_IDBM; - } else if (i == 0) + } + + /* print info the first time through this loop */ + if (i == 0) _debug(ctx, "Waiting for discovery DB lock on %s", LOCK_WRITE_FILE); - usleep(10000); + usleep(DB_LOCK_USECS_WAIT); } if (ret != 0) { - _error(ctx, "Timeout on acquiring lock on DB: %s, errno: %d %s", + _error(ctx, "Timeout on acquiring lock on DB: %s, %d: %s", LOCK_WRITE_FILE, errno_save, _strerror(errno_save, strerr_buff)); return LIBISCSI_ERR_IDBM; } + /* + * if we get here, we were able to "own" the DB by creating + * a link, so we are now the only DB user + */ db->refs = 1; return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/libopeniscsiusr/idbm.h new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/libopeniscsiusr/idbm.h --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/libopeniscsiusr/idbm.h 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/libopeniscsiusr/idbm.h 2024-10-01 21:06:22.000000000 +0200 @@ -40,6 +40,12 @@ #define BOOT_NAME_MAXLEN 256 #define IDBM_DUMP_SIZE 8192 +/* + * wait up to DB_LOCK_USECS_WAIT * DB_LOCK_RETRIES to a cquire + * the DB lock, before giving up + */ +#define DB_LOCK_USECS_WAIT 10000 /* per-loop waiting for lock */ +#define DB_LOCK_RETRIES 3000 /* number of retries */ struct __DLL_LOCAL idbm; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/libopeniscsiusr/sysfs.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/libopeniscsiusr/sysfs.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/libopeniscsiusr/sysfs.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/libopeniscsiusr/sysfs.c 2024-10-01 21:06:22.000000000 +0200 @@ -285,14 +285,18 @@ } } - errno = 0; - tmp_val = strtoll((const char *) buff, NULL, 10 /* base */); - errno_save = errno; - if ((errno_save != 0) && (! ignore_error)) { - rc = LIBISCSI_ERR_BUG; - _error(ctx, "Sysfs: %s: Error when converting '%s' " - "to number", file_path, (char *) buff, errno_save); - goto out; + if (strncmp((const char *) buff, "off", 3) == 0) { + tmp_val = -1; + } else { + errno = 0; + tmp_val = strtoll((const char *) buff, NULL, 10 /* base */); + errno_save = errno; + if ((errno_save != 0) && (! ignore_error)) { + rc = LIBISCSI_ERR_BUG; + _error(ctx, "Sysfs: %s: Error when converting '%s' " + "to number", file_path, (char *) buff, errno_save); + goto out; + } } *val = tmp_val; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/meson.build new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/meson.build --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/meson.build 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/meson.build 2024-10-01 21:06:22.000000000 +0200 @@ -4,7 +4,7 @@ project('open-iscsi', 'c', meson_version: '>= 0.54.0', - version: '2.1.9', + version: '2.1.10', license: 'LGPL-2.1-or-later', default_options: [ 'c_std=gnu99', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/sysfs-documentation new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/sysfs-documentation --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/sysfs-documentation 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/sysfs-documentation 2024-10-01 21:06:22.000000000 +0200 @@ -139,7 +139,7 @@ --- IPv4 Time to Live (TTL) -This attribute contain TTL value sent in IPv4 TCP packets transmitted on +This attribute contains the TTL value sent in IPv4 TCP packets transmitted on iSCSI connections. Valid range: 8-bit value. [0-255] @@ -301,7 +301,7 @@ --- Ethernet MTU Size. -This field specifies the maximum payload length in byte of an +This field specifies the maximum payload length in bytes of an Ethernet frame supported by iSCSI initiator. Valid values: 576 bytes to 9000 bytes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/discovery.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/discovery.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/discovery.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/discovery.c 2024-10-01 21:06:22.000000000 +0200 @@ -682,7 +682,7 @@ return 1; } -static int +static void process_sendtargets_response(struct str_buffer *sendtargets, int final, discovery_rec_t *drec, struct list_head *rec_list) @@ -696,7 +696,7 @@ if (start == end) { /* no SendTargets data */ - goto done; + return; } /* scan backwards to find the last NUL in the data, to ensure we @@ -711,7 +711,7 @@ /* couldn't find anything we can process now, * it's one big partial string */ - goto done; + return; } /* find the boundaries between target records (TargetName or final PDU) @@ -739,7 +739,7 @@ drec, rec_list)) { log_error("failed to add target record"); str_truncate_buffer(sendtargets, 0); - goto done; + return; } num_targets++; } @@ -769,7 +769,7 @@ } else { log_error("failed to add target record"); str_truncate_buffer(sendtargets, 0); - goto done; + return; } } else { /* remove the parts of the sendtargets buffer we've @@ -785,10 +785,6 @@ record - str_buffer_data(sendtargets)); } } - -done: - - return 1; } static void iscsi_free_session(struct iscsi_session *session) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/idbm.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/idbm.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/idbm.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/idbm.c 2024-10-01 21:06:22.000000000 +0200 @@ -898,14 +898,17 @@ return info; } -void idbm_print(int type, void *rec, int show, FILE *f) +int idbm_print(int type, void *rec, int show, FILE *f) { int i; recinfo_t *info; info = idbm_recinfo_alloc(MAX_KEYS); - if (!info) - return; + if (!info) { + log_error("Out of Memory."); + return ISCSI_ERR_NOMEM; + } + switch (type) { case IDBM_PRINT_TYPE_DISCOVERY: @@ -945,6 +948,7 @@ fprintf(f, "%s\n", ISCSI_END_REC); free(info); + return 0; } static void @@ -1341,29 +1345,36 @@ int idbm_print_discovery_info(discovery_rec_t *rec, int show) { - idbm_print(IDBM_PRINT_TYPE_DISCOVERY, rec, show, stdout); - return 1; + int rc; + + rc = idbm_print(IDBM_PRINT_TYPE_DISCOVERY, rec, show, stdout); + return !rc; } int idbm_print_node_info(void *data, node_rec_t *rec) { int show = *((int *)data); + int rc; - idbm_print(IDBM_PRINT_TYPE_NODE, rec, show, stdout); - return 0; + rc = idbm_print(IDBM_PRINT_TYPE_NODE, rec, show, stdout); + return rc; } int idbm_print_host_chap_info(struct iscsi_chap_rec *chap) { + int rc; + /* User only calls this to print chap so always print */ - idbm_print(IDBM_PRINT_TYPE_HOST_CHAP, chap, 1, stdout); - return 0; + rc = idbm_print(IDBM_PRINT_TYPE_HOST_CHAP, chap, 1, stdout); + return rc; } int idbm_print_flashnode_info(struct flashnode_rec *fnode) { - idbm_print(IDBM_PRINT_TYPE_FLASHNODE, fnode, 1, stdout); - return 0; + int rc; + + rc = idbm_print(IDBM_PRINT_TYPE_FLASHNODE, fnode, 1, stdout); + return rc; } int idbm_print_node_flat(__attribute__((unused))void *data, node_rec_t *rec) @@ -1435,43 +1446,79 @@ return 0; } +/* + * lock the DB, ensuring we are the only user, + * waiting as needed (for quite a while) + * + * uses global "db" (pointer to the DB instance) + */ int idbm_lock(void) { int fd, i, ret; + int errno_save = 0; + /* if DB is already being used just increment count and return */ if (db->refs > 0) { db->refs++; return 0; } + /* DB is not being used -- ensure there is a lock dir */ if (access(LOCK_DIR, F_OK) != 0) { - if (mkdir(LOCK_DIR, 0770) != 0) { - log_error("Could not open %s: %s", LOCK_DIR, - strerror(errno)); + if ((mkdir(LOCK_DIR, 0770) != 0) && (errno != EEXIST)) { + log_error("Could not open %s: %d: %s", LOCK_DIR, + errno, strerror(errno)); return ISCSI_ERR_IDBM; } } + /* create the lock file, if needed */ fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666); - if (fd >= 0) - close(fd); + if (fd < 0) { + log_error("Could not open/create lock file: %s", + LOCK_FILE); + return ISCSI_ERR_IDBM; + } + close(fd); - for (i = 0; i < 3000; i++) { + /* + * try to create a link from the lock file to the + * lock "write" file, retrying everying 10 miliseconds + * for up to 30 seconds! + * + * XXX: very long -- should be configurable? + */ + for (i = 0; i < DB_LOCK_RETRIES; i++) { ret = link(LOCK_FILE, LOCK_WRITE_FILE); if (ret == 0) - break; + break; /* success */ + + errno_save = errno; if (errno != EEXIST) { log_error("Maybe you are not root?"); log_error("Could not lock discovery DB: %s: %s", LOCK_WRITE_FILE, strerror(errno)); return ISCSI_ERR_IDBM; - } else if (i == 0) + } + + /* print info the first time through this loop */ + if (i == 0) log_debug(2, "Waiting for discovery DB lock"); - usleep(10000); + usleep(DB_LOCK_USECS_WAIT); /* wait 10 ms */ + } + + if (ret != 0) { + log_error("Timeout on acquiring lock on DB: %s: %d: %s", + LOCK_WRITE_FILE, errno_save, strerror(errno_save)); + return ISCSI_ERR_IDBM; } + /* + * if we get here, we were able to "own" the DB by creating + * a link, so we are now the only DB user + */ db->refs = 1; return 0; } @@ -1491,6 +1538,8 @@ * Backwards Compat: * If the portal is a file then we are doing the old style default * session behavior (svn pre 780). + * + * XXX can't we remove this now? */ static FILE *idbm_open_rec_r(char *portal, char *config) { @@ -2207,7 +2256,7 @@ goto free_portal; } - idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); + rc = idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); fclose(f); free_portal: free(portal); @@ -2271,7 +2320,7 @@ rc = ISCSI_ERR_IDBM; goto free_portal; } - idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); + rc = idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); fclose(f); free_portal: free(portal); @@ -2376,7 +2425,7 @@ goto unlock; } - idbm_print(IDBM_PRINT_TYPE_DISCOVERY, rec, 1, f); + rc = idbm_print(IDBM_PRINT_TYPE_DISCOVERY, rec, 1, f); fclose(f); unlock: idbm_unlock(); @@ -2520,16 +2569,16 @@ if (rc) goto unlock; - if (drec->type == DISCOVERY_TYPE_FW) { - log_debug(8, "setting firmware node 'startup' to 'onboot'"); - newrec->startup = ISCSI_STARTUP_ONBOOT; - newrec->conn[0].startup = ISCSI_STARTUP_ONBOOT; - } log_debug(7, "overwriting existing record"); } else log_debug(7, "adding new DB record"); if (drec) { + if (drec->type == DISCOVERY_TYPE_FW) { + log_debug(8, "setting firmware node 'startup' to 'onboot'"); + newrec->startup = ISCSI_STARTUP_ONBOOT; + newrec->conn[0].startup = ISCSI_STARTUP_ONBOOT; + } newrec->disc_type = drec->type; newrec->disc_port = drec->port; strcpy(newrec->disc_address, drec->address); @@ -3231,7 +3280,7 @@ rec->disc_type = DISCOVERY_TYPE_STATIC; rec->leading_login = 0; rec->session.cmds_max = CMDS_MAX; - rec->session.xmit_thread_priority = XMIT_THREAD_PRIORITY; + rec->session.xmit_thread_priority = DEFAULT_XMIT_THREAD_PRIORITY; rec->session.initial_cmdsn = 0; rec->session.queue_depth = QUEUE_DEPTH; rec->session.nr_sessions = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/idbm.h new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/idbm.h --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/idbm.h 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/idbm.h 2024-10-01 21:06:22.000000000 +0200 @@ -51,6 +51,14 @@ #define NAME_MAXVAL 128 /* the maximum length of key name */ #define VALUE_MAXVAL 256 /* the maximum length of 223 bytes in the RFC. */ #define OPTS_MAXVAL 8 + +/* + * wait up to DB_LOCK_USECS_WAIT * DB_LOCK_RETRIES to a cquire + * the DB lock, before giving up + */ +#define DB_LOCK_USECS_WAIT 10000 /* per-loop waiting for lock */ +#define DB_LOCK_RETRIES 3000 /* number of retries */ + typedef struct recinfo { int type; char name[NAME_MAXVAL]; @@ -167,6 +175,12 @@ int line_number); extern void idbm_recinfo_node(node_rec_t *r, recinfo_t *ri); +/* from libopeniscsiusr/idbm.h */ +enum iscsi_auth_method { + ISCSI_AUTH_METHOD_NONE, + ISCSI_AUTH_METHOD_CHAP, +}; + enum { IDBM_PRINT_TYPE_DISCOVERY, IDBM_PRINT_TYPE_NODE, @@ -175,7 +189,7 @@ IDBM_PRINT_TYPE_FLASHNODE }; -extern void idbm_print(int type, void *rec, int show, FILE *f); +extern int idbm_print(int type, void *rec, int show, FILE *f); struct boot_context; extern struct node_rec *idbm_create_rec(char *targetname, int tpgt, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iface.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iface.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iface.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iface.c 2024-10-01 21:06:22.000000000 +0200 @@ -282,7 +282,7 @@ if (rc) goto close_f; - idbm_print(IDBM_PRINT_TYPE_IFACE, iface, 1, f); + rc = idbm_print(IDBM_PRINT_TYPE_IFACE, iface, 1, f); idbm_unlock(); close_f: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/initiator.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/initiator.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/initiator.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/initiator.c 2024-10-01 21:06:22.000000000 +0200 @@ -395,26 +395,37 @@ session->isid[5] = 0; /* setup authentication variables for the session*/ - iscsi_setup_authentication(session, &rec->session.auth); + if (iscsi_setup_authentication(session, &rec->session.auth)) { + /* + * FIXME: The return value used to be ignored here. It + * would be nice to start paying attention to it, but + * that may break a few corner-case login scenarios, + * and in the case of a root-iSCSI setup, may break it + * badly. So, for now, just print a warning that + * ignoring such errors is being deprecated. + */ + log_warning("Warning: DEPRECATED: Ignoring Authorization setup failure. " + "This will be considered a login authorization error in the future."); + } iscsi_session_init_params(session); - if (t->template->bind_ep_required) { - hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc); - if (!*rc) { - /* - * if the netdev or mac was set, then we are going to want - * to want to bind the all the conns/eps to a specific host - * if offload is used. - */ - session->conn[0].bind_ep = 1; - session->hostno = hostno; - } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) { - goto free_session; - } else { - *rc = 0; - } - } + if (t->template->bind_ep_required) { + hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc); + if (!*rc) { + /* + * if the netdev or mac was set, then we are going to want + * to want to bind the all the conns/eps to a specific host + * if offload is used. + */ + session->conn[0].bind_ep = 1; + session->hostno = hostno; + } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) { + goto free_session; + } else { + *rc = 0; + } + } /* reset session reopen count */ session->reopen_cnt = 0; @@ -1008,11 +1019,14 @@ } static void session_scan_host(struct iscsi_session *session, int hostno, - queue_task_t *qtask) + queue_task_t *qtask, bool rescan) { pid_t pid; - pid = iscsi_sysfs_scan_host(hostno, 1, idbm_session_autoscan(session)); + if (!rescan && !idbm_session_autoscan(session)) + return; + + pid = iscsi_sysfs_scan_host(hostno, session->id, 1, rescan); if (pid == 0) { mgmt_ipc_write_rsp(qtask, ISCSI_SUCCESS); @@ -1062,7 +1076,8 @@ * don't want to re-scan it on recovery. */ if (conn->id == 0) - session_scan_host(session, session->hostno, c->qtask); + session_scan_host(session, session->hostno, c->qtask, + false); log_warning("Connection%d:%d to [target: %s, portal: %s,%d] " "through [iface: %s] is operational now", @@ -1073,7 +1088,7 @@ } else { session->notify_qtask = NULL; - session_online_devs(session->hostno, session->id); + session_scan_host(session, session->hostno, NULL, true); mgmt_ipc_write_rsp(c->qtask, ISCSI_SUCCESS); log_warning("connection%d:%d is operational after recovery " "(%d attempts)", session->id, conn->id, @@ -1226,7 +1241,7 @@ if (sshdr.asc == 0x3f && sshdr.ascq == 0x0e && idbm_session_autoscan(session)) - session_scan_host(session, session->hostno, NULL); + session_scan_host(session, session->hostno, NULL, true); break; case ISCSI_ASYNC_MSG_REQUEST_LOGOUT: conn_warn(conn, "Target requests logout within %u seconds" , ntohs(async_hdr->param3)); @@ -1399,8 +1414,23 @@ uint32_t host_no; /* drivers like bnx2i and qla4xxx do not have a write wq */ - if (session->t->caps & CAP_DATA_PATH_OFFLOAD) + if (session->t->caps & CAP_DATA_PATH_OFFLOAD) { + log_debug(5, "Skipping setting xmit thread priority: Not needed for offload"); + return; + } + + /* + * optimization: if the priority to be set is zero, just + * return now, saving the trouble of scanning the proc table + * + * TODO: this function should be removed some day "soon", since + * it ony seems to be needed in older (5.4) kernels. But for now + * the optimization should be enough + */ + if (session->nrec.session.xmit_thread_priority == 0) { + log_debug(5, "Skipping setting xmit thread priority to zero: not needed"); return; + } proc_dir = opendir(PROC_DIR); if (!proc_dir) @@ -1457,6 +1487,9 @@ if (!setpriority(PRIO_PROCESS, pid, session->nrec.session.xmit_thread_priority)) { closedir(proc_dir); + log_debug(5, "Set priority for pid=%u to \"%d\"", + pid, + session->nrec.session.xmit_thread_priority); return; } else break; @@ -1465,9 +1498,9 @@ } closedir(proc_dir); fail: - log_error("Could not set session%d priority. " - "READ/WRITE throughout and latency could be " - "affected.", session->id); + log_warning("Could not set session%d priority. " + "READ/WRITE throughout and latency could be affected.", + session->id); } static int session_ipc_create(struct iscsi_session *session) @@ -1700,8 +1733,7 @@ * scan host is one-time deal. We * don't want to re-scan it on recovery. */ - session_scan_host(session, session->hostno, - c->qtask); + session_scan_host(session, session->hostno, c->qtask, false); session->notify_qtask = NULL; log_warning("Connection%d:%d to [target: %s, portal: %s,%d] " @@ -1711,6 +1743,7 @@ session->nrec.conn[conn->id].port, session->nrec.iface.name); } else { + session_scan_host(session, session->hostno, NULL, true); session->notify_qtask = NULL; mgmt_ipc_write_rsp(c->qtask, ISCSI_SUCCESS); } @@ -2209,7 +2242,7 @@ log_debug(3, "session created sid %u host no %d", sid, host_no); session_online_devs(host_no, sid); - session_scan_host(NULL, host_no, NULL); + session_scan_host(NULL, host_no, NULL, false); } static void iscsi_async_session_destruction(uint32_t host_no, uint32_t sid) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/initiator_common.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/initiator_common.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/initiator_common.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/initiator_common.c 2024-10-01 21:06:22.000000000 +0200 @@ -38,6 +38,7 @@ #include "sysdeps.h" #include "iscsi_err.h" #include "iscsi_net_util.h" +#include "idbm.h" struct iscsi_session *session_find_by_sid(uint32_t sid) { @@ -61,6 +62,22 @@ int iscsi_setup_authentication(struct iscsi_session *session, struct iscsi_auth_config *auth_cfg) { + /* + * check for authmethod being set correctly, + * and for now just warn user this isn't correct. In the + * future, we should return an error here. + */ + if ((auth_cfg->authmethod == ISCSI_AUTH_METHOD_NONE) && + (auth_cfg->password_length || auth_cfg->password_in_length)) { + /* + * FIXME: if authmethod=None we should really not be using + * CHAP, but fixing this may break some configurations, so + * just warn the user, for now + */ + log_warning("Warning: DEPRECATED: Using CHAP even though 'authmethod' is set to None. " + "In the future 'authmethod=None' will be honored."); + } + /* if we have any incoming credentials, we insist on authenticating * the target or not logging in at all */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_settings.h new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_settings.h --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_settings.h 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_settings.h 2024-10-01 21:06:22.000000000 +0200 @@ -21,8 +21,8 @@ #define CMDS_MAX 128 #define QUEUE_DEPTH 32 -/* system */ -#define XMIT_THREAD_PRIORITY -20 +/* system -- default used for setpriority() of the xmit workqueue process */ +#define DEFAULT_XMIT_THREAD_PRIORITY 0 /* interface */ #define UNKNOWN_VALUE "<empty>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_sysfs.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_sysfs.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_sysfs.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_sysfs.c 2024-10-01 21:06:22.000000000 +0200 @@ -1342,7 +1342,7 @@ if (ret) (info->tmo).lu_reset_tmo = -1; - sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "abort_tmo", + ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "abort_tmo", &((info->tmo).abort_tmo)); if (ret) (info->tmo).abort_tmo = -1; @@ -1979,7 +1979,7 @@ strlen(write_buf)); } -pid_t iscsi_sysfs_scan_host(int hostno, int async, int autoscan) +pid_t iscsi_sysfs_scan_host(int hostno, int sid, int async, bool rescan) { char id[NAME_SIZE]; char *write_buf = "- - -"; @@ -1988,10 +1988,7 @@ if (async) pid = fork(); - if (pid >= 0 && !autoscan) { - if (pid) - log_debug(4, "host%d in manual scan mode, skipping scan", hostno); - } else if (pid == 0) { + if (pid == 0) { /* child */ log_debug(4, "scanning host%d", hostno); @@ -2001,9 +1998,18 @@ */ set_thread_io_flusher(0); - snprintf(id, sizeof(id), ISCSI_HOST_ID, hostno); - sysfs_set_param(id, SCSI_HOST_SUBSYS, "scan", write_buf, - strlen(write_buf)); + if (rescan) { + iscsi_sysfs_for_each_device(NULL, hostno, sid, + iscsi_sysfs_set_device_online); + + /* rescan each device to pick up size changes */ + iscsi_sysfs_for_each_device(NULL, hostno, sid, + iscsi_sysfs_rescan_device); + } else { + snprintf(id, sizeof(id), ISCSI_HOST_ID, hostno); + sysfs_set_param(id, SCSI_HOST_SUBSYS, "scan", write_buf, + strlen(write_buf)); + } log_debug(4, "scanning host%d completed", hostno); } else if (pid > 0) { log_debug(4, "scanning host%d from pid %d", hostno, pid); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_sysfs.h new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_sysfs.h --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_sysfs.h 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_sysfs.h 2024-10-01 21:06:22.000000000 +0200 @@ -17,6 +17,7 @@ #ifndef ISCSI_SYSFS_H #define ISCSI_SYSFS_H +#include <stdbool.h> #include <sys/types.h> #include "sysfs.h" @@ -89,7 +90,7 @@ struct iscsi_session_operational_config *conf); extern void iscsi_sysfs_get_negotiated_conn_conf(int sid, struct iscsi_conn_operational_config *conf); -extern pid_t iscsi_sysfs_scan_host(int hostno, int async, int autoscan); +extern pid_t iscsi_sysfs_scan_host(int hostno, int sid, int async, bool rescan); extern int iscsi_sysfs_get_session_state(char *state, int sid); extern int iscsi_sysfs_get_host_state(char *state, int host_no); extern int iscsi_sysfs_get_device_state(char *state, int host_no, int target, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_util.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_util.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_util.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_util.c 2024-10-01 21:06:22.000000000 +0200 @@ -279,7 +279,7 @@ * * If address1 is blank then it matches any string passed in. */ -static int iscsi_addr_match(char *address1, char *address2) +int iscsi_addr_match(const char *address1, const char *address2) { struct addrinfo hints1, hints2, *res1, *res2; int rc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_util.h new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_util.h --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsi_util.h 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsi_util.h 2024-10-01 21:06:22.000000000 +0200 @@ -30,4 +30,6 @@ struct sockaddr_un; extern int setup_abstract_addr(struct sockaddr_un *addr, char *unix_sock_name); +extern int iscsi_addr_match(const char *address1, const char *address2); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsiadm.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsiadm.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsiadm.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsiadm.c 2024-10-01 21:06:22.000000000 +0200 @@ -787,41 +787,49 @@ const char *target_name, const char *address, int32_t port, const char *iface_name) { - int rc = 0; + int rc = ISCSI_SUCCESS; struct iscsi_node **nodes = NULL; struct iscsi_node *node = NULL; uint32_t node_count = 0; uint32_t i = 0; - bool match = false; bool has_match = false; rc = iscsi_nodes_get(ctx, &nodes, &node_count); if (rc != LIBISCSI_OK) return rc; + log_debug(7, "%s(target_name=%s, address=%s): found %d node(s) to scan ...", + __FUNCTION__, target_name, address, node_count); + for (i = 0; i < node_count; ++i) { node = nodes[i]; - match = true; + /* + * node matches *unless* one of the following conditions + * is true + */ if ((target_name != NULL) && (strlen(target_name) != 0) && (strcmp(target_name, iscsi_node_target_name_get(node)) != 0)) - match = false; + continue; /* target name mismatch */ + if ((address != NULL) && (strlen(address) != 0) && - (strcmp(address, iscsi_node_conn_address_get(node)) != 0)) - match = false; - if ((port != -1) && (port != (int32_t)iscsi_node_conn_port_get(node))) - match = false; + (iscsi_addr_match(address, + iscsi_node_conn_address_get(node)) != 1)) + continue; /* address/name mismatch */ + + if ((port != -1) && + (port != (int32_t)iscsi_node_conn_port_get(node))) + continue; /* port number mismatch */ + if ((iface_name != NULL) && (strlen(iface_name) != 0) && (strcmp(iface_name, iscsi_node_iface_name_get(node)) != 0)) - match = false; + continue; /* iface mismatch */ - if (match == true) { - iscsi_node_print_config(node, show_secret); - has_match = true; - } + iscsi_node_print_config(node, show_secret); + has_match = true; } iscsi_nodes_free(nodes, node_count); @@ -874,7 +882,7 @@ iscsi_sysfs_for_each_device(NULL, host_no, info->sid, iscsi_sysfs_rescan_device); /* now scan for new devices */ - iscsi_sysfs_scan_host(host_no, 0, 1); + iscsi_sysfs_scan_host(host_no, info->sid, 0, false); return 0; } @@ -2026,6 +2034,7 @@ static int iscsi_check_session_use_count(uint32_t sid) { char *config_file; char *safe_logout; + int rc = 0; config_file = get_config_file(); if (!config_file) { @@ -2034,10 +2043,11 @@ } safe_logout = cfg_get_string_param(config_file, "iscsid.safe_logout"); - if (!safe_logout || strcmp(safe_logout, "Yes")) - return 0; + if (safe_logout && !strcmp(safe_logout, "Yes")) + rc = session_in_use(sid); + free(safe_logout); - return session_in_use(sid); + return rc; } int iscsi_logout_flashnode_sid(struct iscsi_transport *t, uint32_t host_no, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsid.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsid.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsid.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsid.c 2024-10-01 21:06:22.000000000 +0200 @@ -221,7 +221,9 @@ iscsi_err_to_str(err)); return 0; } - iscsi_sysfs_scan_host(host_no, 0, idbm_session_autoscan(NULL)); + + if (idbm_session_autoscan(NULL)) + iscsi_sysfs_scan_host(host_no, info->sid, 0, false); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsid_req.h new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsid_req.h --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/iscsid_req.h 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/iscsid_req.h 2024-10-01 21:06:22.000000000 +0200 @@ -19,7 +19,7 @@ */ #ifndef ISCSID_REQ_H_ -#define ISCSID_REQ_H +#define ISCSID_REQ_H_ #define ISCSID_REQ_TIMEOUT 1000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/sysfs.c new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/sysfs.c --- old/open-iscsi-2.1.9.suse+844.d557967bc9ae/usr/sysfs.c 2023-12-20 19:21:30.000000000 +0100 +++ new/open-iscsi-2.1.10.suse+52.9a4cb8fdee02/usr/sysfs.c 2024-10-01 21:06:22.000000000 +0200 @@ -563,7 +563,12 @@ if (!sysfs_value) return EIO; - *value = atoi(sysfs_value); + if (strncmp(sysfs_value, "off", 3) == 0 && + strncmp(subsys, "iscsi_session", 13) == 0) { + *value = -1; + } else { + *value = atoi(sysfs_value); + } free(sysfs_value); return 0; }
participants (1)
-
Source-Sync