summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* iscsi initiator: avoid relogin during sync upsync-speedupMike Christie2022-02-271-21/+33
| | | | | | | | Try to detect if the kernel exports the necessary info to check if the session is up and has not fired a conn error while iscsid has been down. If the session is ok, then don't relogin during session sync up. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* iscsi sysfs: add helpers to get conn state and cleanup stateMike Christie2022-02-272-0/+27
| | | | | | | Add some helpers to get the conn state and test if the connection has sent a conn error and needs to be cleaned up. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* iscsid: batch sync requestsMike Christie2022-02-271-20/+46
| | | | | | | | If we are doing root over iscsi and iscsid is doing its initial start up, then we want to read in the config data for all sessions we want to sync then send iscsid the sync requests which can drop the session. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* iscsid: speed up resyncMike Christie2022-02-271-1/+6
| | | | | | | | We don't need to wait for the relogin to complete when sending the sync response. The caller does not know if the sync did a relogin and does not even check if it did or not. This has us return immediately. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* iscsid: simplify qtask handlingMike Christie2022-02-272-136/+93
| | | | | | | | | We only have qtasks for login/sync or logout. There is no need to pass it around when we can just have 2 pointers for the 2 types. We can then quickly check if a login or logout is in progress and in the future kill a running login when we get a logout request. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* Merge pull request #303 from wenchao-hao/conn_logChris Leech2022-02-253-99/+142
|\ | | | | Make session and connect log helpful to locate problem
| * mgmt: print connection info when write qtask response failedWenchao Hao2022-02-251-2/+6
| | | | | | | | | | | | | | print session and connection id when write qtask response failed if these ids are accessible Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
| * Make session and connect log readable and helpful to locate problemWenchao Hao2022-02-251-97/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | There are many logs like following which are not helpful to locate problem when there are multiple sessions: "unsupported opcode 0xxxx" We can not know which connection the log belongs to, so this commit find these logs in initiator.c and add session id, connection id for them. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
| * Add conn_xxx() macros to print connection info in more detailsWenchao Hao2022-02-251-0/+41
| | | | | | | | | | | | | | conn_info() conn_warn() conn_error() and conn_debug() are added. conn_xxx() macros would print session id and connection id in log. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* | Merge pull request #307 from scaleoutsean/masterLee Duncan2022-02-231-3/+3
|\ \ | | | | | | Fix minor error string typos (editor: and grammar)
| * | Fix minor error string typosscaleoutSean2022-02-221-3/+3
|/ /
* | Merge pull request #305 from gonzoleeman/fix-iscsi-gen-initiatornameLee Duncan2022-02-191-25/+26
|\ \ | | | | | | Remove HEREIS usage from iscsi-gen-initiatorname
| * | Remove HEREIS usage from iscsi-gen-initiatornameLee Duncan2022-02-171-25/+26
|/ / | | | | | | | | | | | | This script can be called early in the boot process, when /tmp is not writable (but /etc/iscsi is), so change the usage of HEREIS to simple variables. Otherwise, no change in functionality.
* | Preparing for version 2.1.6Lee Duncan2022-02-143-2/+44
|/
* Merge pull request #300 from wenchao-hao/actor_logChris Leech2022-02-084-36/+61
|\ | | | | actor: introduce thread name which would be printed to log.
| * initiator_common: make set operational parameter log easy to readWenchao Hao2022-02-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iscsid would print log like following if debug level is larger than 3: iscsid: set operational parameter 35 to: iscsid: 30 iscsid: set operational parameter 30 to: iscsid: 5 which is not friendly to read, this commit makes it easy to read, like this: iscsid: set operational parameter 35 to: 30 iscsid: set operational parameter 30 to: 5 Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
| * actor: enhanced: print error log when init a initilized threadWenchao Hao2022-02-081-0/+4
| | | | | | | | | | | | This is only a enhance, do not change origin logic Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
| * actor: print thread name in logWenchao Hao2022-02-082-27/+34
| | | | | | | | | | | | | | This commit is append of 3cf5539 which just print the thread name in log. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
| * actor: add name to struct actor and init it with function nameWenchao Hao2022-02-022-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous actor log makes it hard to figure out what is going on in the thread, such as: "deleting a scheduled/waiting thread!" We only know a thread is deleted, while no other info like what this thread is about to do and which thread it is. Logs like following seems better: "deleting a scheduled/waiting thread 01111e48: session_conn_error !" It tells thread with id 01111e48, which is going to executed function "session_conn_error" is deleted. The commit tries to give name to each thread, the name is going to be printed with previous messages to make the log easy to read. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* | Merge pull request #301 from wenchao-hao/fix_multiple_syncLee Duncan2022-02-082-0/+7
|\ \ | |/ |/| Fix multiple sync of a same session id
| * iscsid: Check session id before start sync a threadWenchao Hao2022-02-082-0/+7
|/ | | | | | | | | | | | | | | | | | | If session id has already been synced just return ISCSI_ERR_SESS_EXISTS. A same session id would make two MGMT_IPC_SESSION_SYNC requests in following scenario: iscsid.socket is enabled, and iscsid did not handle previous MGMT_IPC_SESSION_SYNC due to abnormal exit. This MGMT_IPC_SESSION_SYNC request would left unhandled, when iscsid restart again, newly started iscsid can get this MGMT_IPC_SESSION_SYNC request. While the newly started iscsid would make a MGMT_IPC_SESSION_SYNC request for same session id too. So here should check if the session id has already been synced. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* Merge pull request #298 from wenchao-hao/fix_installLee Duncan2022-01-281-1/+1
|\ | | | | Fix wrong install_systemd destination path
| * Fix wrong install_systemd destination pathWenchao Hao2022-01-281-1/+1
|/ | | | | | | | | Previous implement would installl systemd files to "/usr/lib/systemd/system/system" which should be "/usr/lib/systemd/system". Fix this by updating variable systemddir. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* Merge pull request #297 from gonzoleeman/gcc12-fixesLee Duncan2022-01-274-14/+13
|\ | | | | Fix issues discovered by gcc12
| * Fix more issues discovered by gcc12Lee Duncan2022-01-262-3/+3
| | | | | | | | | | | | Gcc-12 caught a few more errors in the code, where we are still checking an array address for NULL, which will never happen.
| * Fix issues discovered by gcc12Lee Duncan2022-01-252-11/+10
|/ | | | | Gcc-12 caught a few errors in the code where we were checking for an array being empty incorrectly, so this commit fixes those.
* Merge pull request #295 from wenchao-hao/fis_iscsi_errLee Duncan2022-01-111-0/+1
|\ | | | | iscsi_err: Add iscsid request timed out error messages
| * iscsi_err: Add iscsid request timed out error messagesWenchao Hao2022-01-101-0/+1
|/ | | | | | | | | Commit 67eb8b2 added error code ISCSI_ERR_REQ_TIMEOUT. While did not update array iscsi_error_list which referenced in iscsi_err_to_str(). Which would access a invalid memory with when variable of iscsi_err_to_str() is ISCSI_ERR_REQ_TIMEOUT. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* Merge pull request #289 from samy-mahmoudi/fix-etc-iscsid.conf-1Lee Duncan2021-12-131-43/+50
|\ | | | | Improve 'iscsid.conf'
| * Improve 'iscsid.conf'Samy Mahmoudi2021-12-091-43/+50
| |
* | Merge pull request #291 from mikechristie/iscsistart-fixesLee Duncan2021-12-083-24/+11
|\ \ | | | | | | iscsistart fix and timeout cleanup
| * | iscsid: add error code for req timeoutsiscsistart-fixesMike Christie2021-12-032-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | ISCSI_ERR_SESSION_NOT_CONNECTED does not make sense to return when a request times out if the request is not for login. This adds a new error code. Signed-off-by: Mike Christie <michael.christie@oracle.com>
| * | iscsid: use infinite timeout if passed inMike Christie2021-12-031-7/+0
| | | | | | | | | | | | | | | | | | | | | If the caller passes in -1 for the timeout then we can just pass that to poll instead of waking up and retrying the poll over and over. Signed-off-by: Mike Christie <michael.christie@oracle.com>
| * | iscsistart: fix login timeout handlingMike Christie2021-12-031-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should set the timeout to -1 for the login request becuase if we've connected to our event loop then the login will either complete, fail and hit the login retries limit in the initiator, or we will crash and we will exit. Either way we are going to return evetually, and the user can configure the retries so they can also limit the time they will wait. If we've sent a login request to our event loop we also don't want to send another one because the initiator will see it on its session loop and just return immediately. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* | | Merge pull request #293 from cleech/for_upstreamLee Duncan2021-12-081-1/+1
|\ \ \ | |/ / |/| | libopeniscsiusr: extend sysfs ignore_error to include EINVAL
| * | libopeniscsiusr: extend sysfs ignore_error to include EINVALChris Leech2021-12-071-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel change "e746f3451ec7 scsi: iscsi: Fix iface sysfs attr detection" fixed an apparently very-long-standing issue blocking iface attribute visibility in sysfs. With that fixed, and networking configuration for the iface now being readable from sysfs, iscsiadm is showing errors when be2iscsi (and probably qla4xxx from looking at the code) expose VLAN attributes but don't have a VLAN configured. Both drivers then return EINVAL on a read to vlan_id or vlan_priority. iSCSI ERROR: Error when reading '/sys/class/iscsi_iface/ipv4-iface-17-0/vlan_id': 22 # sysfs.c:iscsi_sysfs_prop_get_ll():282 iSCSI ERROR: Error when reading '/sys/class/iscsi_iface/ipv4-iface-17-0/vlan_priority': 22 # sysfs.c:iscsi_sysfs_prop_get_ll():282 This change makes the libopeniscsiusr code ignore a read return of EINVAL when ignore_error is set, treating it the same as a non-existent sysfs file for optional attributes. Signed-off-by: Chris Leech <cleech@redhat.com>
* | Merge pull request #290 from gonzoleeman/fix-iscsi-gen-initiatornameLee Duncan2021-12-033-23/+87
|\ \ | |/ |/| Fix iscsi-gen-initiatorname
| * Install new man page for iscsi-gen-initiatornameLee Duncan2021-12-031-1/+1
| |
| * Add man page for the iscsi-gen-initiatorname script.Lee Duncan2021-12-031-0/+36
| |
| * change iscsi-gen-initiatorname option -b => -pLee Duncan2021-12-031-5/+5
| | | | | | | | | | This matches with iscsi-iname, which already exists and is used by this script.
| * Update the iscsi-gen-initiatorname script: harden and generalizeLee Duncan2021-12-031-22/+50
|/ | | | | | | | | | | | | | | | | | | | | | | | | The iscsi-gen-initiatorname script seems only to be used by the SUSE distrubution, so it has never been very "general". This update makes the script more resiliant, with better error messages if a problem occurs, as well as more generic, allowing the caller to set the "base IQN" value, though the default contains to be the same. Changes: - Added use of getopts to parse options - Added a "-h" option for help - Added an option to supply base IQN - Added better checking of options and params - Added comments to the script itself - Now check to see if iname file can be written to (handling read-only mounts better) - Fixed initiator name listed in file (it was wrong) - Removed use of printf(1) - Fixed iBFT initiator name setting in general - Now set iname file mode to 0600 even when it comes from iBFT - Cleaned up the script to use variables instead of repeating file pathnames or other values
* Merge pull request #287 from wenchao-hao/fix_segLee Duncan2021-11-191-2/+3
|\ | | | | iscsiadm: Call log_init() first to fix a segmentation fault
| * iscsiadm: Call log_init() first to fix a segmentation faultWenchao Hao2021-11-191-2/+3
|/ | | | | | log_init() should be called before log_error() Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* Cosmetic cleanup on recent additionLee Duncan2021-11-111-2/+2
| | | | | cleaned up the new define using SBINDIR to match the rest of the code.
* Fixing last parts of sbindir configurationLee Duncan2021-11-112-2/+2
| | | | | Two small bits in libopeniscsi usr were missed when making sbindir configurable. One was just cosmetic.
* remove redundant params in MakefileLee Duncan2021-11-111-1/+1
| | | | remove a merge error
* Merge pull request #285 from gonzoleeman/fix-iscsi-initLee Duncan2021-11-111-0/+1
|\ | | | | Fix iscsi-init so that it runs when root writable
| * Fix iscsi-init so that it runs when root writableLee Duncan2021-11-101-0/+1
|/ | | | | | | | | | A recent commit, 432bbf979ee6 ("Remove dependences from iscsi-init.service") removed DefaultDependencies from iscsi-init.service, but that now means it can run so early that the root disc is not yet writable, rendering it useless, since it can't create the initiatorname.iscsi file. This change tells it to wait until root is writable to run.
* Merge pull request #284 from mikechristie/chk-stateLee Duncan2021-11-061-1/+24
|\ | | | | iscsi sysfs: check state before onlining devs
| * iscsi sysfs: check state before onlining devschk-stateMike Christie2021-11-051-1/+24
|/ | | | | | | | | | | | | | | | | | | In 5.6, the commit: commit 0ab710458da113a71c461c4df27e7f1353d9f864 Author: Bharath Ravi <rbharath@google.com> Date: Sat Jan 25 01:19:25 2020 -0500 scsi: iscsi: Perform connection failure entirely in kernel space made it so the kernel can start the recovery process. This means that after the start conn operation the kernel could set the device into the block stated. We can then hit a race where iscsid has done start conn, and is calling session_online_devs but the kernel has hit an issue and is now setting the device's to blocked. This adds a check for if the device is in the offline state before trying to set the state to running.