summaryrefslogtreecommitdiff
path: root/usr
Commit message (Collapse)AuthorAgeFilesLines
* iscsid/iscsiuio: fix OOM adjustment (#377)Lee Duncan2022-10-142-21/+28
| | | | | | | | | | | | | | | | | | | | | | * iscsid/iscsiuio: fix OOM adjustment For both the iscsid and iscsiuio daemons, they try to modify nice value and OOM adjustment value, so they have priority and will not be killed by the OOM-killer. But the code incorrectly set the value to "-17" for modern linux systems, when the maximum is actually "-1000". While making the changes, use "/proc/self/..." instead of "/proc/<PID>/...", so we don't have to use getpid() nor print out the pathname. Now we either write "-16" to the old interface, "-1000" to the new interface, or we print a warning. Several "log_debug()" calls that should have been warnings are changed to "log_warning()" calls in iscsid. * iscsid/iscsiuio: fix OOM adjustment value for older systems On older linux system, "-17" is the maximum, not "-16".
* Use meson as the main build system (#365)Lee Duncan2022-09-212-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Build: Add an iscsiuio 'build_date.sh' script This is currently unused, but will be used by meson to build the "build_date.[ch]" files used by iscsiuio. * Build: have git ignore file '.setup' I commonly use this file for shell aliases/functions. * Add framework to support building using meson. This adds the ability to use meson/ninja to build open-iscsi and iscsiuio, rather than the current system that uses 'autoconf' for iscsiuio and uses 'make' for everything else. The old make/autoconf system is left in place, for now, but deprecated, including a warning about that when running 'make all' or 'make user' from the top-level. * utils/build: enhance iscsi-iname to generate prefix Added new "-g/--generate-iname-prefix" argument to generate the InitiatorName= prefix. Also, updated iscsi-iname to use getopts. Also, use the new option from meson. * git/meson: remove 'builddir' from ignored files The build directory can be called anything. Suggested by: Eli Schwartz * iscsiuio build: fix new build_date.sh script Fixed several issues: - fix option handling for "-S" - fix epoch date handling from env (noticed by Eli Schwartz) - remove debug statements * iscsiuio meson: warn when not creating a symlink for iscsiuio * meson: install man pages more efficiently We don't need to specify path or subdirectory * iscsiuio meson: remove unused source date epoch option This option was never used, since we pass this info from the environment. * meson: no need to set libdir: default is fine * iscsiuio meson: no need to add c_args: already there * Don't generate initiatorname when cross-building (#367) Let it be generated by the iscsi-init service. Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> * Set ISCSI_CONFIG_ROOT by meson Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> * Set LOCK_DIR from home_dir to lock_dir Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> * Install iface.example to db_root/ifaces Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> Co-authored-by: TIAN Yuanhao <78596099+tianyuanhao@users.noreply.github.com> Co-authored-by: TIAN Yuanhao <tianyuanhao3@163.com>
* Small bug fixes (#364)Lee Duncan2022-09-063-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * build: move utils/sysdeps to top-level The routines here are used by iscsiuio, so move them to the top level. * libopeniscsiusr: fix kernel-doc bugs There were errors in four places, effecting the generated manual pages. * libopeniscsiusr: clean up kernel-doc usage Simplify generation of library interface documentation using the kernel-doc script: * make the kernel-doc perl script executble (the only visible change) * remove mention of sed (not used) * stop compressing man pages -- let distros do that * improve kernel-doc so that doc-preclean.pl and split-man.pl are no longer needed * add list-man-pages.sh to simplify things (copied from libnvme) * build: keep current version number in one place Move the current version number (now 2.1.7) into the top-level Makefile, and out of usr/version.h and libopeniscsiusr/version.h, completely eliminating the need for the latter. Note that this ties the libopeniscsiusr library idea of "version" to the usr/ (iscsid, etc) idea of version, even though they used to be defined separately. But they always had the same value, so nothing lost. * build: insteall man pages uncompressed We were delivering some man pages compressed and other not, and it turns out distros know how to install man pages using the compression they prefer, so stop doing it for them.
* Cleanup fwparam makefile (#360)Lee Duncan2022-08-131-2/+0
| | | | | * Ignore template-generated man pages * build: fwparam_ibft does not need libopeniscsiusr
* Fix a possible passing null pointer in usr/iface.c (#356)shugaley2022-07-281-3/+5
|
* Merge pull request #342 from wenchao-hao/iface_paramLee Duncan2022-05-201-0/+1
|\ | | | | Add ability to specify name-value parameters when creating a new iface
| * iscsiadm: enable specify iface name-value parameters when creating ifaceWenchao Hao2022-04-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Add ability to specify name-value parameters when creating a new iface like following: root# iscsiadm -m iface -I test -o new -n iface.initiatorname -v iqn.2016-04.com.open-iscsi:17a3c9bc2d test updated. New interface test added root# iscsiadm -m iface -I test | grep initiatorname iface.initiatorname = iqn.2016-04.com.open-iscsi:17a3c9bc2d Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* | Use config for iscsistart and iscsiadm fw loginEric Mackay2022-05-183-28/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifying name-value pairs as arguments to iscsistart or iscsiadm can become unwieldy very quickly, and is less flexible than using a config file. If a user desires to update settings, modifying a config file and rebuilding initramfs can be simpler than modifying arguments directly in initramfs code or scripts. Node records created from boot context are populated with defaults, then any settings specified in a config file are applied (if config is present). FW and user-specified params are still applicable. User-specified name-value arguments are applied after config settings, so they can serve as a safeguard against config file changes if desired. Added -c|--config options for iscsistart to specify the config Updated iscsistart man page Signed-off-by: Eric Mackay <eric.mackay@oracle.com> Reviewed-by: Mike Christie <michael.christie@oracle.com>
* | Add ability for MGMT IPC to check UID onlyEric Mackay2022-05-168-26/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default behavior in iscsid, which is to check mgmt IPCs for UID==0 and user explicitly named "root", is unchanged. This option to perform only the UID check for management IPCs can be enabled in iscsid.conf. This can be useful for running iscsid in a constrained environment, e.g., initramfs. For instance, klibc initramfs in Ubuntu and Debian does not include a user DB. Attempting to run iscsid and iscsiadm in klibc initramfs would result in ISCSI_ERR_ACCESS for all MGMT IPCs. Specifying just the UID check allows iscsid and iscsiadm to run in klibc initramfs without a user DB. systemd can still start an iscsid process later in boot with the default full MGMT IPC auth checks, leaving the steady-state behavior of iscsid the same as before. The following setting in iscsid.conf enables this behavior: iscsid.ipc_auth_uid = Yes iscsistart now uses this mechanism to only perform the UID check, rather than statically linking against an alternate implementation of getpwuid(). This is effectively the same behavior as before. Signed-off-by: Eric Mackay <eric.mackay@oracle.com> Reviewed-by: Mike Christie <michael.christie@oracle.com>
* | Add a 'distclean' Makefile top-level targetLee Duncan2022-05-091-0/+4
| | | | | | | | | | | | | | | | | | | | This cleans up a little more than "make clean", in particular removing files generated from templates, and automake-generated files in iscsiuio. Also, a ".PHONY:" target was added where needed so that each Makefile has a complete list of phony targets.
* | Merge pull request #343 from mikechristie/fix-logoutLee Duncan2022-05-071-7/+8
|\ \ | | | | | | iscsid: fix logout pdu send failure detection handling
| * | iscsid: fix logout pdu send failure handlingfix-logoutMike Christie2022-04-201-7/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug where when we send logout pdu we are incorrectly handling it as an error. This was added in https://github.com/open-iscsi/open-iscsi/pull/317 I think there might have been a mistake for which version of that patch got merged because there are some unhandled review comments in the merged code. The patch also fixes some review comments that were given in that review but were not handled when it was merged: 1. No space before "Dropping session" 2. Don't split error messages.
* | Preparing for version 2.1.7.Lee Duncan2022-05-061-1/+1
|/
* Make fwparam_ibft build more reliable.Lee Duncan2022-04-132-1/+23
| | | | | | | | | | | | | | | | This build has lex and bison source files, but they are not normally used to regenerate C files, since that has been done ahead of time, statically, to handle the case when users building the software may not have these tools. But some build systems think the generated C files need to be regenerated because the timestamp on the source and generated files is so close, just because of the order the files were populated in this directory. So we tell the Makefile to only generate C files if those files are missing. This should have no effect, since these files should never need to be regenerated unless we change lex or bison logic.
* Merge pull request #333 from thesamesam/masterLee Duncan2022-04-102-4/+4
|\ | | | | Build system tweaks from downstream
| * Makefiles: don't hardcode sed, pkg-configSam James2022-04-061-1/+1
| | | | | | | | | | | | | | | | | | - On my system, sed appears to be at /bin/sed. So, let's allow overriding the location. - Allow different pkg-config paths too (useful for cross). Signed-off-by: Sam James <sam@gentoo.org>
| * Makefiles: respect $(CC) fully (don't hardcode GCC); use $(RM)Sam James2022-04-062-3/+3
| | | | | | | | | | | | | | - Don't hardcode GCC, instead respect the detected CC (or from the environment) - Use $(RM) as the location may vary and we've already done the work to detect it Signed-off-by: Sam James <sam@gentoo.org>
* | Build: add libsystemd CFLAGS for building objectsLee Duncan2022-04-041-0/+1
|/ | | | | | This is already done for libkod in usr/Makefile, so do the same for libsystemd, even though most times these flags will be empty, that is not always the case.
* Fix gcc issues with unused params in fwparamLee Duncan2022-04-022-7/+18
| | | | | | Moving these files, as done recently, means they now can be compiled with different (more strict) options, so mark unused params as such.
* Remove unused fwparam_ibft.[ch] files in fwparam_ibft.Lee Duncan2022-03-313-654/+5
| | | | These files are apparently unused, so remove them.
* Build: cleanup usr Makefile: remove obj files on "clean"Lee Duncan2022-03-311-3/+8
| | | | | | | Commit 61443d7db7de ("Build: Cleanup fwparam_ibft and sysdeps subdirs." changed the "clean" target in usr/Makefile so that it no longer removed all object files, rather just removing the ones it knows about. But that commit missed some object files.
* Add a README for fwparam_ibft subdirectory.Lee Duncan2022-03-311-0/+23
| | | | Help explain some of the mystery of this directory.
* Build: Cleanup fwparam_ibft and sysdeps subdirs.Lee Duncan2022-03-3116-10/+7102
| | | | | | | | | | | | This commit moves the "fwparam_ibft" subdirectory from being under "utils" to being under "usr", where its actually used. It also updates usr/Makefile so that it's smarter about how and when to build the fwparam_ibft object files it needs, as well as how to build sysdeps.o. From the top-level Makefile, "make user" will now make the fwparam_ibft files, as needed for the "user" targets, before building iscsid and friends.
* Make DB and ISCSIHOME directories configurable.Lee Duncan2022-03-257-21/+32
| | | | | | | | | | | | | | | | | | | | This commit adds two new top-level build options: one for the "home" directory for open-iscsi called "HOMEDIR", and one for the "database" directory, called "DBROOT". One can now override the defaults of "/etc/iscsi" for either or both of these directories on the make command line. The README and man pages are updated with details about these new options. Some Makefile cleanup/repair was done as well. Installation of the initiatorname.iscsi file, was moved out of the top-level Makefile into the etc subdirectory, and installation of man ages moved from the top-level Makefile to the doc subdirectory. Also, this fixes some issues from commit fd14dd8316b1 ("Clean p Makefile build system."), which incorrectly changed the DESTDIR ariable in the Makefiles. This current commit also fixes the top-level variable names for moving DBROOT and HOMEDIR.
* Clean up the usage info for iscsidLee Duncan2022-03-231-9/+9
| | | | Just a little grammar cleanup.
* Merge pull request #324 from gonzoleeman/cleanup_build_system_and_templatesLee Duncan2022-03-231-1/+17
|\ | | | | Clean up Makefile build system.
| * Clean up Makefile build system.Lee Duncan2022-03-201-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A major overdue overhaul of the Make layout, including moving lots of lower-level things out of the top-level Makefile into the Makefiles for the appropriate subdirectory, renaming the template files (where @SBINDIR@ gets translated) so that their purpose is more obvious, making the build more idempotent (no need to install a file if it's not newer). Should be no functional change, as no script or C file changed. Main difference from before: now the udev rules gets made and installed by default (as part of "make"/"make install"), and the iscsiuio daemon is now installed for "make install". One should now be able to go into any subdirectory and type "make"/"make install" to build and install the targets from that directory, at least for the etc, utils, and usr subdirectories. This change is in preparation for more template translations coming.
* | Allow name/value args for firmware logins.Lee Duncan2022-03-161-9/+68
|/ | | | | | | | | | | This adds 2 things to the firmware login mode: first, it adds sane default values for NOP-OUTs (off), login retry max, and type of scan. Lastly, it also gives the caller the ability to set name/value pairs on the command line, which gives the ability to override these new defaults if desired. The output of "iscsiadm -h" was also cleaned up a bit, removing duplicate spaces.
* initiator:print failure reason of iscsi_send_logout() if failedWenchao Hao2022-03-041-3/+8
| | | | | | | print the failure reason of iscsi_send_logout() which is helpful to locate problem when error happened. Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
* initiator: return ENOMEM if failed to get ev_context in iscsi_send_logout()Wenchao Hao2022-03-041-4/+20
| | | | | | | | | | | | | | | | | | If iscsi_send_logout() is called from iscsi_stop() or session_login_task() and return 0, the next logout flow such as session_conn_shutdown() depends on target's logout response and logout timeout. While if iscsi_send_logout() failed to trigger a logout timeout task, and target's logout response absent, the logout flow would hang. So we should return error if iscsi_send_logout() failed to trigger a logout timeout task. And add comment about handle logic if iscsi_send_logout() failed from iscsi_recv_async_msg() by hand. Signed-off-by: Wenchao Hao <haowenchao@huawei.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>
* | Fix minor error string typosscaleoutSean2022-02-221-3/+3
| |
* | Preparing for version 2.1.6Lee Duncan2022-02-141-1/+1
|/
* 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>
* | 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>
* 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.
* 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>
* iscsid: add error code for req timeoutsiscsistart-fixesMike Christie2021-12-031-1/+1
| | | | | | | | 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>
* 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>
* 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.