summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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 #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.
* 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