scst_pass_through_cmd_done can run in interrupt context, and call
scst_replace_port_info, which in turn was calling scst_lookup_tg_id.
Since scst_lookup_tg_id does a mutex_lock, we should not call it from
interrupt context.
Add scst_cmd_inquired_dev_ident and use in various locations.
Support for the following mm layer changes in the Linux kernel v6.7:
- c42d50aefd17 ("mm: shrinker: add infrastructure for dynamically
allocating shrinker")
This patch refactors scst_put_acg() to directly call kref_put() with a
release callback that handles removal of scst_acg from the workqueue.
This replaces the previous approach of queuing a work item for each
kref_put() call, improving efficiency by reducing the number of queued
work items.
According to kernel documentation, this flag should be set if the
workqueue will be involved in the kernel's memory reclamation flow.
Since it is not, there is no need for the driver's WQ to have this
flag set so remove it.
create_workqueue() was replaced with alloc_workqueue() with max_active set
to 0. However, the original create_workqueue() implicitly set max_active
to 1.
This change has led to unexpected bugs because previously, work items
could only be executed one by one. With the change, they can now be
executed simultaneously.
This patch fixes the issue by restoring max_active to 1.
Fixes: f4686e9102 ("scst: Remove deprecated create_workqueue()")
Fixes: https://github.com/SCST-project/scst/issues/179
Unbreak the build for the previous commit against kernel versions
before v5.16.
See also commit 3080ea5553cc ("stddef: Introduce DECLARE_FLEX_ARRAY()
helper") # v5.16.
strlcpy() reads the entire source buffer first. This read may exceed the
destination size limit. This is both inefficient and can lead to linear
read overflows if a source string is not NULL-terminated [1].
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
Support for the following block layer changes in the Linux kernel v6.5:
- 05bdb9965305 ("block: replace fmode_t with a block-specific type for
block open flags")
- 0718afd47f70 ("block: introduce holder ops")
- 2736e8eeb0cc ("block: use the holder as indication for exclusive opens")
Enable exclusive opening of block devices to prevent concurrent usage.
Additionally, remove the redundant 'holder' argument for
'blkdev_get_by_path()' where exclusive opening isn't utilized.
The prepare_to_wait_exclusive_head() function was modified in
commit d8894cbd11 ("scst.h: Refactor wait_event_locked() to enhance
usability and clarity"). It now returns an error if the current
interruptible thread has pending signals.
This patch introduces the scst_wait_for_cmd() helper function for the
scst_cmd_thread(). This new function handles the return value of the
prepare_to_wait_exclusive_head() appropriately.
This patch fixes the following Coverity complaint:
CID 321410 (#1 of 1): Unchecked return value (CHECKED_RETURN)
check_return: Calling prepare_to_wait_exclusive_head without
checking return value.
The scst_wait_event_interruptible_lock_irq() function now implicitly
checks for pending signals. Therefore, there is no need to check for
these signals explicitly. This patch replaces the explicit check with a
simple evaluation of the function's return value.
This patch doesn't change any functionality.
This patch replaces percpu_ref_kill() with percpu_ref_kill_and_confirm()
to guarantee safe usage of references in atomic mode immediately
afterwards.
This change ensures accurate checking of active commands following the
initial reference killing.
Reported-by: Lev Vainblat <lev@zadarastorage.com>
This patch changes the processing threads to use INTERRUPTIBLE sleep
states in the scst_wait_event_...() functions. This aims to avoid
warnings from the hung task detection checker and to prevent
unnecessary load counting.
Fixes: d8894cbd11 ("scst.h: Refactor wait_event_locked() to enhance usability and clarity")
This patch modifies scst_sync_ext_block_dev() to support INTERRUPTIBLE
waiting and handle signal-induced waiting cancellation. To achieve this,
the waitqueue head is moved from the stack and allocated with the blocker.
Additionally, reference counting and its management are added to the
blocker to handle memory freeing from multiple contexts.
Fixes: https://github.com/SCST-project/scst/issues/164
This patch divides the scst_ext_block_dev() function into two separate
functions to improve code readability and simplify maintenance:
1. scst_sync_ext_block_dev() - This function is for synchronous blocking
and serves as the equivalent of calling the old scst_ext_block_dev()
function with the SCST_EXT_BLOCK_SYNC flag.
2. scst_ext_block_dev() - This function is for asynchronous blocking.
Additionally, the patch introduces the helper function
scst_dev_ext_block() to reduce code duplication between the
scst_sync_ext_block_dev() and scst_ext_block_dev() functions.
This patch doesn't change any functionality.
1. Set the default process state to TASK_UNINTERRUPTIBLE during sleep.
This change is made because our current code does not check whether a
process was interrupted by a signal.
2. Prefix all SCST wait_event-related macros with 'scst_'. This helps to
distinguish SCST-specific macros from those provided by the Linux
kernel itself.
3. Add the capability to return an error code when a process in a
non-TASK_UNINTERRUPTIBLE state is interrupted by a signal.
4. Divide the wait_event_locked function based on each lock type,
resulting in the following new functions: scst_wait_event_lock(),
scst_wait_event_lock_bh(), and scst_wait_event_lock_irq().
Fix the following compiler error:
ERROR: modpost: "scst_dlm_cluster_name" [...] undefined!
The error occurs because the declaration of scst_dlm_cluster_name is
located in the scst_dlm.c file, but it's used in the scst_sysfs.c file.
As a result, when building without DLM, this variable lacks a declaration.
To resolve this, the declaration is moved to the scst_main.c file, and the
variable scst_dlm_cluster_name is renamed to scst_cluster_name.
Fixes: 00f31004ab ("scst_sysfs: Add support for cluster_name")
This patch fixes the following warnings:
/lib/.../scst_cdrom.ko needs unknown symbol scst_obtain_device_parameters
/lib/.../scst_cdrom.ko needs unknown symbol scst_unregister_dev_driver
...
These warnings were caused by an incorrect module installation order:
the SCST module was being installed after the device handler modules
on which they depend. This patch rectifies the issue by altering the
order in which the modules are installed.
Additionally, this patch fixes the missing signatures for the device
handler modules.
This patch fixes the installation process for Linux kernels where the
default value of INSTALL_MOD_DIR differs from `extra`.
For instance, it unbreaks `make rpm` against Fedora's kernels, where
INSTALL_MOD_DIR is set to `updates`.
1. Correct a typo, changing `make release` to `make 2release`.
2. Add information about package-related targets to the help section.
3. Remove `dev_handler` directory during the uninstall process.
4. Eliminate the non-existent `tgt` target from the PHONY targets.
5. Introduce SCST_MOD_DIR and SCST_DH_MOD_DIR as helper variables.
Previously, when scst_pr_send_ua_reg attempted to deliver a UNIT ATTENTION
to a registrant that was on another node in a dlm-based HA cluster, the
unit attention was dropped.
Rectify by adding a pr_reg_queue_rem_ua function to struct scst_cl_ops and
calling it from scst_pr_send_ua_reg.
Each registrant will maintain an incoming 'queue' of unit attentions by
adding next_rem_ua_idx to the registrant data maintained in the DLM. This
will tell the other nodes which PR_REG_UA_LOCK lock to create in the
lockspace in order to 'send' a unit attention to the registrant.
Further, each node will also maintain two lists (pending and sent) for the
outgoing unit attentions from this node to a registrant. When the
recipient has read all the sent unit attentions (and cleared
next_rem_ua_idx), then the sent list may be cleared.
Support for the following driver core changes in the Linux kernel v6.4:
- 1aaba11da9aa ("driver core: class: remove module * from class_create()")
- 2243acd50ac4 ("driver core: class: remove struct class_interface * from callbacks")
Add a setting to scst_tgt that can prevent scst_gen_aen_or_ua from
generating an AEN, even if the underlying transport is capable of
transmitting them. It will instead generate a UA.
In the previous commit, we introduced the use of RCU protection when
accessing sess_tgt_dev_list in scst_get_max_lun_commands().
As a result, we can now drop the use of scst_mutex when accessing the
list.
We must always protect sess_tgt_dev_list during access and
modification.
There are two mechanisms for that:
- tgt_dev_list_mutex for list modifications.
- RCU for read-only list accesses.
Currently, the codebase doesn't consistently apply protection when
accessing the list. Fix this by adding RCU protection.
See also commit 3e64094b0c ("scst_sysfs: Do not suspend I/O for LUN
management").
Commit 9be09fd68b ("scst/include/backport.h: Fix building on
RHEL 8.8") fixed the build for RHEL 8.8, but at the same time, it
broke the build for RHEL 9.0.