Writing to the sync attribute after the last target device has detached,
or while the virtual device is inactive, dereferences a NULL file pointer.
The blockio branch likewise passes a missing block device to the flush
helper. The sync attribute was introduced in 2015 without checking whether
the backend was open or serializing against its release.
Run the operation through the SCST sysfs work mechanism and keep a device
reference until it finishes. Suspend command and task management activity
to exclude backend reopen from MODE SELECT and resets. Hold scst_mutex and
the ALUA lock across the open check and flush to exclude detach, explicit
activation and ALUA transitions. This also closes the race that a NULL
check alone would leave behind.
Activity remains globally suspended until the flush completes, so a slow
backend can delay commands to other devices as well.
Return -ENOMEDIUM for a closed backend instead of opening an inactive
device. Preserve the nullio no-op and the existing fileio/blockio flush
selection. The sysfs work mechanism avoids taking scst_mutex directly in
a sysfs callback and provides the usual -EAGAIN completion protocol.
A device kobject reference does not keep the handler attached after the
sysfs store returns. Check dh_priv under scst_mutex as well and return
-ENODEV if handler teardown won the race with the queued work.
Keep backend dispatch in a private helper so KUnit can exercise it with
task-scoped stubs on an unregistered device. Enable the existing closed-
backend cases without queueing a synthetic device to the sysfs thread.
Fixes: 530af782ed ("scst_vdisk: Add 'sync' sysfs attribute")
Link: https://github.com/SCST-project/scst/issues/394
Overview
This is the source code repository of the SCST project. SCST is a collection of Linux kernel drivers that implement SCSI target functionality. The SCST project includes:
- The SCST core in the scst/ subdirectory.
- A tool for loading, saving and modifying the SCST configuration in directory scstadmin/.
- Several SCSI target drivers in the directories iscsi-scst/, qla2x00t-32gbit/, qla2x00t/, srpt/, scst_local/ and fcst/.
- User space programs in the usr/ subdirectory, e.g. fileio_tgt.
- Various documentation in the doc/ subdirectory.
Documentation
- Building and installing SCST.
- Build options: Clang, cross-compilation, and kernel module signing.
- Configuration and administration: targets, devices,
LUNs, and
/etc/scst.conf. - Core and device handlers: operating modes, module parameters, and sysfs configuration.
- Target drivers: iSCSI, iSER, QLogic Fibre Channel, SRP, FCoE, and local loopback.
- Performance tuning.
- Clustered persistent reservations: synchronization through DLM.
- T10 protection information: data integrity modes and configuration.
- Developer references: architecture and userspace handler interface (SGML sources), and sysfs interface rules.
- Contributing: code style, commit conventions, local checks, and guides to KUnit and component testing.
Current master packages
Prebuilt x86_64 packages from the latest successfully published master
build are available in the rolling
master-rpm prerelease.
These are development snapshots, not SCST releases.
The snapshot contains RPM bundles for selected Rocky Linux and Oracle Linux
UEK kernels. It also contains Ubuntu LTS bundles with scst-dkms, scstadmin
and iscsi-scst binary packages and their Debian source package files. Exact
distribution releases and RPM kernel versions are included in the asset names.
Every .tar.gz bundle has a matching .sha256 file. The complete snapshot is
replaced after each successful package workflow for the current master
commit.
QLogic target driver
Two QLogic target drivers are included in the SCST project.
The default driver is located in the qla2x00t-32gbit directory. It is the newer one.
May anyone wish to switch back to the older driver that only supported up to
16 Gb/s adapters, it is located in qla2x00t directory. To make use of the
older driver build scst with environment variable QLA_32GBIT=no set.
Vladislav Bolkhovitin vst@vlnb.net, http://scst.sourceforge.net
