summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Merge pull request #283 from gonzoleeman/fix-usr-mergeLee Duncan2021-10-287-58/+42
|\ | | | | Finish ability to have binaries in an alternate location
| * Finish ability to have binary location configurable.Lee Duncan2021-10-286-14/+31
| | | | | | | | | | | | | | | | | | | | A Recent commit, fff82c57f5df ("Use "sbindir" for path in systemd service files") added the ability to have our binaries in another location rather than /sbin (e.g. /usr/sbin), but it was incomplete. This commit finishes the job. Fixes: fff82c57f5dfe6d3db795f1195b4d2ebc497d33c
| * Updated README a bitLee Duncan2021-10-251-44/+11
|/ | | | | | | | Remove stuff about a kernel module, since that's ancient history. Also, add a bit about compiling iscsiuio, since it's part of open-iscsi now, and lastly update info on putting the binaries some place other than /sbin, if desired.
* Merge pull request #279 from gonzoleeman/allow-bindir-config-for-systemd-filesLee Duncan2021-09-305-6/+10
|\ | | | | Use "sbindir" for path in systemd service files
| * Use "sbindir" for path in systemd service filesLee Duncan2021-09-305-6/+10
|/ | | | | | | | | | Use a variable for the sbin directory where executables go in our systemd unit files, so that the files can be configured, during installation, to have the correct path, instead of just hard-coding these paths. Now "make sbindir=/SOME/PATH ..." works correctly for different paths.
* Merge pull request #278 from gonzoleeman/fix-iscsi-start-dependenciesLee Duncan2021-09-291-0/+1
|\ | | | | Remove dependences from iscsi-init.service
| * Remove dependences from iscsi-init.serviceLee Duncan2021-09-291-0/+1
|/ | | | | | | Since iscsid.service depends on it but disables default dependencies, iscsi-init.service must also disable default dependencies, or a dependency loop can be created.
* Merge pull request #277 from gonzoleeman/fix-recent-commit-gcc-error-v2Lee Duncan2021-09-181-1/+1
|\ | | | | Fix compiler error introduced with recent IPv6 commit.
| * Fix compiler error introduced with recent IPv6 commit.Lee Duncan2021-09-181-1/+1
|/ | | | | | | | | | | | | Commit 76350316de38 ("Handle IPv6 interfaces correctly.") added a string copy that creates this gcc-11 error message: > gcc-11 -O2 -g -Wall -Werror -Wextra -fvisibility=hidden -fPIC -I/usr/include/kmod -c -o idbm.o idbm.c > idbm.c: In function ‘_idbm_node_rec_link’: > idbm.c:999:17: error: ‘strncpy’ specified bound 65 equals destination size [-Werror=stringop-truncation] > 999 | strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ So copy one less character, maximum.
* Preparing for version 2.1.5Lee Duncan2021-09-053-2/+29
|
* Merge pull request #272 from gonzoleeman/handle-ipv6-betterLee Duncan2021-09-028-52/+123
|\ | | | | Handle ipv6 better
| * Handle IPv6 interfaces correctly.Lee Duncan2021-09-013-11/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For IPv6 interface files (in iscsi/ifaces), assume the interface uses IPv4 unless it has "ipv6" in the name. Also, when creating interface files, name them ending with "ipv6.N" or "ipv4.N", where "N" is the interface number (normally zero). This was being done in one place, and this commit makes sure all places that create interface files use this convention. Note that iscsiadm cannot determine if the interface file is IPv6 vs IPv4 from the contents because of the way it processes those files: it creates a template of "legal" values, then processes the file. But it needs to know IPv4 vs IPv6 when creating the template.
| * Update iscsiadm man pageLee Duncan2021-09-011-15/+12
| | | | | | | | | | Clarify/clean up the discovery mode synopsis, and clean up the description of discovery mode.
| * Update iface.example for ipv6Lee Duncan2021-09-011-2/+9
| | | | | | | | | | Make it clear that ipv6 interface files need to have the string "ipv6" in their names.
| * Change iscsi IP type from defines to enum.Lee Duncan2021-09-013-16/+28
| | | | | | | | | | | | | | This lets the compiler help us find errors, if any. Change the declaration and usage to match. Simplify the function that decides, while we are at it. Should be no functional change.
| * Handle qedi correctly in NPAR modeLee Duncan2021-09-011-8/+6
| | | | | | | | | | | | | | Use the correct driver, and handle the NPAR 4-MAC-ADDr offset of qedi, unlike other Offload cards. Found-by: David Bond <DBond@suse.com>
* | Merge pull request #271 from gulams/masterLee Duncan2021-09-021-1/+1
|\ \ | |/ |/| Handle recv() returning 0 in iscsid_response()
| * Handle recv() returning 0 in iscsid_response()gulams2021-08-261-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description: ------------ Due to any issue on target side or any other underlying network issue, the initiator will get "connection refused" error when it tries to connect to the iscsi target. Once it gets the connection refused error, the error handler will try to re-connect to the target after 3 seconds and this will be repeated till the timeout of 120 seconds for the initial login. After this, the connection will be terminated and shutdown. After this, when the image installation started to upgrade the iscsi-initiator-utils, first systemd tried to Reload the daemon and started tryign to login iscsi devicces, which triggered the iscsi connection to the target which was down (for which we had the initial login failed as mentioned above). This trigger of connection was from the iscsiadm (iscsi.service) which got the connection refused error. So, it will be retried. But now systemd stopped the iscsid for updating the iscsi-initiator-utils which was started again later. Since the iscsid daemon was stopped, the retry logic in iscsid_response() function kept polling and went into indefinite loop: int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, int timeout) { ... ... while (len) { struct pollfd pfd; pfd.fd = fd; pfd.events = POLLIN; err = poll(&pfd, 1, timeout); <<< This poll returned err = 1 if (!err) { if (poll_wait) continue; return ISCSI_ERR_SESSION_NOT_CONNECTED; } else if (err < 0) { if (errno == EINTR) continue; log_error("got poll error (%d/%d), daemon died?", err, errno); return ISCSI_ERR_ISCSID_COMM_ERR; } else if (pfd.revents & POLLIN) { <<< We came here which returned 0 err = recv(fd, rsp, sizeof(*rsp), MSG_WAITALL); if (err < 0) { log_error("read error (%d/%d), daemon died?", err, errno); break; } len -= err; iscsi_err = rsp->err; } } ... ... } In the above code poll() was returning 1 (indicating success and the poll fd was existing and will be closed only after this while loop) and revents was set to POLLIN. So, we enetered the last "else if" block and tried to recv the message from the target. Since the target was shutdown gracefully (due to which we were getting connection refused errors), the recv() call returned 0 as no bytes were received. Since the bytes received was 0, the value of "len" did not change due to which the while loop is repeated again. The status on pfd was not changed as there was nobody to change it and also it was not yet closed (will be closed only after the while loop is exited). So, the poll again returned 1. Hence we again tried to receive the bytes from target which again returned 0. So, this went into infinite loop and hence the iscsi.service got stuck on iscsiadm. This caused the iscsi-initiator-utils update process to get stuck and in-turn the image installation got stuck. Fix: The fix is to handle the case, by exiting the while loop, when the recv() returns the 0 bytes indicating that the remote target service (the peer) had an orderly shutdown.
* Merge pull request #270 from mikechristie/prctl-flusher-supportLee Duncan2021-07-291-0/+14
|\ | | | | iscsid: set PR_SET_IO_FLUSHER
| * iscsid: set PR_SET_IO_FLUSHERprctl-flusher-supportMike Christie2021-07-281-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | When iscsid makes syscalls that lead to memory allocations the kernel might use GFP_KERNEL. This can lead to pages being written to iscsi disks managed by iscsid. If we are doing a syscall to try and reconnect the session the disk is accessed through then we could deadlock. When in the iscsi layer we can select our GFP flags but when making syscalls to the network layer we have to set PR_SET_IO_FLUSHER so we use the correct GFP flags. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* | Merge pull request #266 from manishrangankar/iscsiuio-fixesLee Duncan2021-07-282-3/+19
|\ \ | |/ |/| bnx2x.c: Re-initialize bp->version with baseline version.
| * bnx2x.c: Re-initialize bp->version with baseline version.Manish Rangankar2021-07-092-3/+19
| | | | | | | | | | | | | | | | In case eth device failed to return correct version, then we will initialize bp->version with baseline instead of assigning unknown version number. Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
* | Merge pull request #268 from gonzoleeman/add-qede-offload-supportLee Duncan2021-07-201-0/+8
|\ \ | |/ |/| Support the "qede" CNA-card driver.
| * Support the "qede" CNA-card driver.Lee Duncan2021-07-201-0/+8
| | | | | | | | The iscsi_offload command needs to recognize the "qede" driver.
* | Merge pull request #265 from cleech/for_upstreamLee Duncan2021-06-171-2/+2
|\ \ | | | | | | iscsistart: fix null pointer deref before exit
| * | iscsistart: fix null pointer deref before exitChris Leech2021-06-161-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | Fixes regression caused by "open-iscsi: Clean user_param list when process exit" Which is a shame, as not freeing a memory at process exit doesn't really hurt anything. Same change as "Fix iscsiadm segfault when exiting" applied to iscsiadm. Fixes: b532ad67d495d42026165a26515c645995d23f18 Signed-off-by: Chris Leech <cleech@redhat.com>
* | Merge pull request #264 from gonzoleeman/fw-discovery-onboot-fixLee Duncan2021-05-121-0/+6
|\ \ | |/ |/| Set default 'startup' to 'onboot' for FW nodes
| * Set default 'startup' to 'onboot' for FW nodesLee Duncan2021-05-111-0/+6
|/ | | | | | | | | | When "iscsiadm -m discovery -t fw" is ran, nodes are created/updated in the node DB for each firmware target found, but the 'startup' mode values are left as 'manual', when in fact firmware nodes are treated as if this value is 'onboot'. So to keep the node DB in sync with behavior, set these to 'onboot' by default. This should *not* effect any other functionality.
* Merge pull request #261 from gonzoleeman/add-fw-async-loginLee Duncan2021-04-282-11/+17
|\ | | | | Add iscsiadm "no wait" option for firmware login.
| * Add iscsiadm "no wait" option for firmware login.Lee Duncan2021-04-272-11/+17
|/ | | | | In addition, update the iscsiadm help message, and the iscsiadm man page.
* Merge pull request #260 from gulams/masterLee Duncan2021-04-251-1/+2
|\ | | | | Check ISCSI_ERR_ISCSID_NOTCONN in iscsistart login
| * Check ISCSI_ERR_ISCSID_NOTCONN in iscsistart logingulams2021-04-201-1/+2
|/ | | In login_session() function, we need to check for error ISCSI_ERR_ISCSID_NOTCONN also. When the login command is sent to the iscsid using iscsid_exec_req(), it will try to connect to iscsid using the function ipc_connect(). If there is an issue in iscsid or if we are not able to create the socket due to some reason, then the error ISCSI_ERR_ISCSID_NOTCONN is returned. We need to retry the login command by checking the error ISCSI_ERR_ISCSID_NOTCONN.
* Merge pull request #259 from gulams/masterLee Duncan2021-04-191-1/+1
|\ | | | | Log error message when auth debug status is set
| * Log error message when auth debug status is setgulams2021-04-161-1/+1
|/ | | Log the correct error message in /var/log/messages when the debug status is set when there is an authentication error. The change is made in check_security_stage_status() function. This issue was identified when one of the customer was trying to login to the iscsi target after configuring the mutual CHAP authentication. They set the same password for both side authentication. This is not allowed as per the code as it was returning AUTH_DBG_STATUS_PASSWD_IDENTICAL. The error logged in /var/log/messages was not obvious. This change will help to understand the correct error message so that required action can be taken.
* Preparing for version 2.1.42.1.4Lee Duncan2021-03-113-2/+41
|
* Merge pull request #253 from cleech/iscsi_sessions_getChris Leech2021-03-113-13/+38
|\ | | | | Iscsi sessions get
| * libopeniscsiusr: dont error loudly if a session isn't found when working ↵Chris Leech2021-02-171-5/+16
| | | | | | | | | | | | | | | | | | | | | | through iscsi_sessions_get() Suppress the error message from iscsi_session_get when it's being called through iscsi_sessions_get now that it's not being treated as an error. There's no reason to be so alarmed the session being read in isn't specified exactly. Signed-off-by: Chris Leech <cleech@redhat.com>
| * libopeniscsiusr: skip over removed sessionsChris Leech2021-02-171-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When looping over all sessions with iscsi_sessions_get, it's possible to race against sessions being destroyed and have the sysfs attribute files be removed before they're read. Let's not treat this as an error, and simply drop the session that failed to read from the list. I think it makes sense to treat session that disapear while they're being read as if they were already gone when the sessions directory was first scanned. Apparently having iscsiadm exit with an error when trying to get a list of sessions is a problem for OpenStack deployments. Signed-off-by: Chris Leech <cleech@redhat.com>
| * libopeniscsiusr: fix error messagesChris Leech2021-02-173-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The error message in iscsi_session_get [libopeniscsiusr/session.c:140] when a session or connection path isn't found in sysfs was failing to print the session ID, instead it printed the address of the static string for the remainder of the message ("does not exists") due to an extra comma. Additionally change all occurances of "does not exists" to "does not exist" Signed-off-by: Chris Leech <cleech@redhat.com>
* | Merge pull request #254 from gonzoleeman/iscsi-service-login-nowaitLee Duncan2021-03-112-4/+4
|\ \ | |/ |/| Enable iscsi.service asynchronous logins, cleanup services
| * Enable iscsi.service asynchronous logins, cleanup servicesLee Duncan2021-03-112-4/+4
|/ | | | | | | | | Add the "-W" (no wait) flag to the iscsiadm login command in iscsi.service, so that the service succeeds even if one or more of the targets being logged on to is not available at startup time. Also, clean up the iscsi.service and iscsid.service files.
* Merge pull request #250 from zeha/crossLee Duncan2021-02-171-3/+14
|\ | | | | Avoid hardcoding pkg-config to fix cross build
| * Avoid hardcoding pkg-config to fix cross buildHelmut Grohne2021-02-151-3/+14
|/ | | | Debian Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982307
* Merge pull request #248 from gonzoleeman/iscsistart-timeout-fixLee Duncan2021-02-041-2/+15
|\ | | | | Fix iscsistart login issue when target is delayed.
| * Fix iscsistart login issue when target is delayed.Lee Duncan2021-02-041-2/+15
|/ | | | | | | | | | | | | | | | | | | | | Earlier commit 9258c8eae046 changed the return value fron iscsid_response() from ISCSI_ERR_ISCSID_NOTCONN to ISCSI_ERR_SESSION_NOT_CONNECTED in the case where no iscsi response is received when expected. This effected the login code in iscsistart when the target is not completely ready at iscsi login time. This commit updates iscsistart to expect the new error code, but fixing this uncovered another issue, causing iscsistart logins to continue to fail if the target returned its login response too slowly. This commit ups the timeout time for iscsistart logins from 1 second per try to 10 seconds per try. This is perhaps excessive, and a shorter delay would be more appropriate, but the retry/nanosleep logic in iscsistart meant to retry the login in such cases seems problematic in this case, since retrying the 2nd time returns "session already exists", and most iscsistart clients aren't prepared for the command to return a non-zero return value.
* Merge pull request #247 from matwey/iscsi_serviceLee Duncan2021-02-021-0/+1
|\ | | | | Wants=network-online.target in iscsi.service
| * Wants=network-online.target in iscsi.serviceMatwey V. Kornilov2021-02-011-0/+1
|/ | | | | | | | | | | | | | | | | Setting After= without Requires= or Wants= is not enough to pull network-online.target as a dependency. Currently, if some other service requires network-online.target then iscsi.service is started after network-online.target If no any other services require network-online.target then iscsi.service may be started before networking is working. The latter leads to the following issues: iscsiadm: Could not login to [iface: default, target: XXX, portal: XXX,3260]. iscsiadm: initiator reported error (4 - encountered connection failure) Reference: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
* Fix iscsiadm segfault when exitingLee Duncan2021-01-261-4/+4
| | | | | | | | | | Commit b532ad67d495d added some cleanup code to iscsiadm right before it exits, but it used a list_for_each_entry() to iterate through a list was being deleted, when it should use list_for_each_entry_safe(). Fixes: b532ad67d495d
* Merge pull request #246 from B4dM4n/no-systemd-buildLee Duncan2021-01-251-0/+2
|\ | | | | iscsid: Add NO_SYSTEMD to CFLAGS