308 Commits

Author SHA1 Message Date
Gleb Chesnokov
8a3b257c33 scst: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Linux kernel Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci against the SCST tree.

This patch doesn't change any functionality.
2026-04-12 15:38:24 +03:00
Gleb Chesnokov
eeae35607d scst: Change the return type of the .queuecommand() callback
In clang version 21.1 and later the -Wimplicit-enum-enum-cast warning
option has been introduced. This warning is enabled by default and can
be used to catch .queuecommand() implementations that return another
value than 0 or one of the SCSI_MLQUEUE_* constants. Hence this patch
that changes the return type of the .queuecommand() implementations from
'int' into 'enum scsi_qc_status'. No functionality has been changed.
2026-04-08 14:31:45 +03:00
Gleb Chesnokov
b2a1f6e66a Bump the version number to 3.11.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 11 0 -pre
2025-12-29 13:06:44 +03:00
Gleb Chesnokov
d4cb03e2b8 Bump the version number to 3.10.0
These changes have been generated by running the following command:

$ scripts/update-version 3 10 0
2025-12-29 12:40:21 +03:00
Tony Battersby
1a7cfc8e68 scst_cmd_set_sn: remove lockless fast path
The lockless fast path for scst_cmd_set_sn() can cause commands to
lockup in state EXEC_CHECK_SN when there are multiple scst_tgts
accessing the same scst_device, for example two initiators
connected to the two ports of a dual-port QLogic FC HBA in target mode
both reading from the same shared disk.  The multithreaded_init_done
value is too low-level for this; it does not take the higher-level
configuration into account.

- Remove the lockless fast path.
- Remove multithreaded_init_done, which enabled/disabled the lockless
  fast path.
- Push the locking down into scst_cmd_set_sn(), which will now apply
  regardless of set_sn_on_restart_cmd, which matters for mixed-driver
  (e.g. iSCSI+qla2xxx) target-mode setups.
- Remove a bunch of comments explaining the rules for the lockless fast
  path.

Fixes: https://github.com/SCST-project/scst/issues/333
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2025-12-11 12:19:22 +03:00
Gleb Chesnokov
3fb16aa624 scst: Unbreak the RHEL 10.1 build
Fixes: https://github.com/SCST-project/scst/issues/317
2025-12-09 11:53:38 +03:00
Gleb Chesnokov
2c69fe018c scst: Use block layer helpers to calculate num of queues
The calculation of the upper limit for queues does not depend solely on
the number of online CPUs; for example, the isolcpus kernel
command-line option must also be considered.

To account for this, the block layer provides a helper function to
retrieve the maximum number of queues. Use it to set an appropriate
upper queue number limit.
2025-10-01 22:11:28 +03:00
Tony Battersby
63f2375fe4 kbuild: Remove stack protector flags
-fstack-protector-strong is controlled by the in-tree
CONFIG_STACKPROTECTOR_STRONG config option.  If the flag is set without
the config option, scst fails to build:
ERROR: modpost: "__stack_chk_fail" [scst/src/scst.ko] undefined!

-fstack-clash-protection is disabled in the kernel's Makefile due to an
incompatibility with randomize_kstack_offset.

Fixes: 86d3d4bb1d ("kbuild: Enable additional compiler warnings")
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2025-09-08 16:40:12 +03:00
Gleb Chesnokov
44bd290fea scst: Add RHEL 8.10 and 9.6 kernel support
Add compatibility for RHEL 8.10 and RHEL 9.6 kernels. Update nightly build
and regression test configs, and adjust version checks in the codebase
to handle changes in these new RHEL kernel releases.
2025-05-26 17:37:09 +03:00
Gleb Chesnokov
977904d33a scst: Use separate sysfs_emit_at() for emitting SCST_SYSFS_KEY_MARK
Replace combined sysfs_emit() calls with separate sysfs_emit() and
sysfs_emit_at() invocations when emitting SCST_SYSFS_KEY_MARK in sysfs
attribute show handlers.

This improves code clarity and consistency, explicitly handling the
conditional addition of SCST_SYSFS_KEY_MARK.

This patch does not change any functionality.
2025-05-19 20:46:54 +03:00
Gleb Chesnokov
0e8fdad5e4 scst: Use sysfs_emit/sysfs_emit_at instead of scnprintf()
Replace scnprintf() with sysfs_emit() and sysfs_emit_at() in sysfs show handlers.

These helper functions are specifically designed for sysfs output, providing safer
handling of buffer lengths and consistency across kernel sysfs interfaces.

This patch does not change any functionality.
2025-05-19 20:46:54 +03:00
Gleb Chesnokov
989802f48d scst: Replace snprintf() with scnprintf()
Replace snprintf() with scnprintf() in two places:

- code paths that build up a buffer incrementally
- sysfs attribute “show” handlers

scnprintf() guarantees its return value is the number of bytes actually
written (never exceeding the buffer), preventing potential overruns.

This patch does not change any functionality.
2025-05-19 20:46:54 +03:00
Gleb Chesnokov
9cbca53830 scst: Replace sprintf() with scnprintf() in sysfs callbacks
Replace all uses of sprintf() with scnprintf() in sysfs attribute
callbacks to eliminate the risk of buffer overflows.

This patch does not change any functionality.
2025-05-16 16:37:43 +03:00
Gleb Chesnokov
86d3d4bb1d kbuild: Enable additional compiler warnings
Add additional compiler flags to improve code compliance.
2025-03-25 18:57:32 +03:00
Gleb Chesnokov
a2c1c2d8b2 qla2x00t, qla2x00t-32gbit, scst_local: Port to Linux kernel v6.14
Support for the following scsi layer changes in the Linux kernel v6.14:

- ed638918f4df ("scsi: Rename .slave_alloc() and .slave_destroy()")
- 49515b7fe50c ("scsi: Convert SCSI drivers to .sdev_configure()")
- c9a71ca13f71 ("scsi: Constify struct pci_device_id")
- bd326a5ad639 ("scsi: replace blk_mq_pci_map_queues with blk_mq_map_hw_queues")
2025-03-25 16:53:57 +03:00
Gleb Chesnokov
f52ae117b8 scst: Port to Linux kernel v6.13
Support for the following changes in the Linux kernel v6.13:

- cdd30ebb1b9f ("module: Convert symbol namespace to string literal")

Fixes: https://github.com/SCST-project/scst/issues/273
2025-01-20 18:54:10 +03:00
Gleb Chesnokov
2bdc19a61f Bump the version number to 3.10.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 10 0 -pre
2024-12-28 17:14:54 +03:00
Gleb Chesnokov
a68cb8e94d Bump the version number to 3.9.0
These changes have been generated by running the following command:

$ scripts/update-version 3 9 0
2024-12-28 16:44:09 +03:00
Gleb Chesnokov
48120c5f6e scst_local: Fix multiple checkpatch warnings
This patch does not change any functionality.
2024-12-28 14:59:04 +03:00
Gleb Chesnokov
61f365f96e scst: Expand all create*_workqueue() invocations
The workqueue maintainer wants to remove the create*_workqueue() macros
because these macros always set the WQ_MEM_RECLAIM flag and because these
only support literal workqueue names. Hence this patch that replaces the
create*_workqueue() invocations with the definition of this macro. The
WQ_MEM_RECLAIM flag has been retained because I think that flag is necessary
for workqueues created by storage drivers.
2024-11-07 14:02:05 +03:00
Gleb Chesnokov
667ef768a0 scst_local: Port to Linux kernel v6.11
Support for the following driver core changes in the Linux kernel v6.11:

- d69d80484598 ("driver core: have match() callback in struct bus_type
  take a const *")
2024-09-04 12:54:26 +03:00
Gleb Chesnokov
faa8f460d7 scst_local, qla2x00t-32gbit: Improve Linux kernel 6.10 porting
Fix compilation warnings, errors.
2024-07-15 15:18:16 +03:00
Gleb Chesnokov
c3bd33a34f qla2x00t-32gbit, scst_local: Port to Linux kernel v6.10
Support for the following scsi layer changes in the Linux kernel v6.10:

- 5b7dfbeff92a ("scsi: core: Add a dma_alignment field to the host and
  host template")
2024-07-08 13:45:29 +03:00
Gleb Chesnokov
188256792c Bump the version number to 3.9.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 9 0 -pre
2024-01-15 15:33:45 +03:00
Gleb Chesnokov
1171841931 Bump the version number to 3.8.0
These changes have been generated by running the following command:

$ scripts/update-version 3 8 0
2024-01-15 13:59:19 +03:00
Gleb Chesnokov
6c2771baef Makefile: Specify the installation directory for SCST modules explicitly
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`.
2023-06-14 16:49:36 +03:00
Gleb Chesnokov
85e8086a7e Makefile: Implement several improvements to SCST Makefiles
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.
2023-06-14 16:49:36 +03:00
Gleb Chesnokov
3dad1e957d scst: Unbreak the build for kernel versions <= 6.3
The previous series of patches introduced the use of a const pointer to
scsi_host_template. However, scsi_host_alloc() uses a non-const pointer
prior to kernel version 6.4, causing the build to throw the following
error:

    passing argument 1 of ‘scsi_host_alloc’ discards ‘const’
    qualifier from pointer target type

Hence, cast away the constness to resolve the error.
2023-05-02 23:14:06 +03:00
Gleb Chesnokov
33dedb2946 scst_local: Declare SCSI host template const
Make it explicit that the SCSI host template is not modified.
2023-04-28 15:22:58 +03:00
Gleb Chesnokov
87681c0d9a scst: Unbreak the RHEL 9.2 build
See also PR https://github.com/SCST-project/scst/pull/145.
2023-04-06 13:02:25 +03:00
Gleb Chesnokov
70dfb06c40 scst: Fix a checkpatch complaint about whitespace
This patch fixes the following checkpatch warnings:

    WARNING:SPACE_BEFORE_TAB: please, no space before tabs.
2023-04-04 11:47:44 +03:00
Gleb Chesnokov
b78582f34d Bump the version number to 3.8.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 8 0 -pre
2022-12-28 17:08:44 +03:00
Gleb Chesnokov
1ef10b852d Bump the version number to 3.7.0
These changes have been generated by running the following command:

$ scripts/update-version 3 7 0
2022-12-27 16:47:20 +03:00
Chesnokov Gleb
c5766b27da scst_local: Remove support for kernel versions before 3.10
The SCST has dropped support for kernels older than 3.10.0 (RHEL 7 / Centos 7) since SCST v3.6.
2022-01-13 17:26:37 +03:00
Chesnokov Gleb
64a8485fe7 Bump the version number to 3.7.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 7 0-pre
2022-01-11 16:37:34 +03:00
Bart Van Assche
9c5406664a Bump the version number to 3.6.0
These changes have been generated by running the following command:

$ scripts/update-version 3 6 0
2021-12-29 19:19:14 -08:00
Bart Van Assche
af579d68c3 scst_local: Port to Linux kernel v5.16
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9599 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-11-22 03:48:38 +00:00
Bart Van Assche
8a2352239b scst_local: Port to Linux kernel v5.15
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9592 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-11-03 14:29:16 +00:00
Bart Van Assche
cb74f66766 scst_local: Port to Linux kernel v5.15
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9503 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-09-03 04:59:06 +00:00
Bart Van Assche
84d335f131 scst_local: Make the SCSI host number available in sysfs
An example for the following SCST configuration:

TARGET_DRIVER scst_local {
	TARGET scst_local_tgt {
		session_name scst_local_host

		LUN 0 dummy
		LUN 1 test1
		LUN 2 test2
	}
}
    
$ cat /sys/kernel/scst_tgt/targets/scst_local/scst_local_tgt/sessions/scst_local_host/host_no
9


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9488 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-08-14 03:24:11 +00:00
Bart Van Assche
c0151f6cda Bump the version number to 3.6.0
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9310 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-01-02 23:16:59 +00:00
Bart Van Assche
d3c92ea7aa Bump the version number to 3.5.0
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9231 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-22 03:38:21 +00:00
Bart Van Assche
cf4a11725a scst: Unbreak the non-RHEL build
This patch is a fix for r9221.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9227 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-21 19:54:08 +00:00
Bart Van Assche
5f2e23c23b scst, scst_local: Port to RHEL / CentOS 8.3
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9221 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-20 04:26:40 +00:00
Bart Van Assche
d10a7bf5d5 Restore support for building with clang
The previous commit removed support for building with clang. Restore support
for building with clang without breaking cross-compilation support.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9209 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-05 21:23:17 +00:00
Bart Van Assche
8eb850acce Revert "Make it possible to build SCST with clang"
Since commit ecea60a694 breaks cross-compilation, revert it.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9208 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-12-05 18:39:38 +00:00
Bart Van Assche
ecea60a694 Make it possible to build SCST with clang
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9089 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-08-02 21:19:24 +00:00
Bart Van Assche
7569ddaf2e Makefiles: Remove -Wextra
Since not all kernel header files are compatible with -Wextra, remove -Wextra.
To enable -Wextra, build SCST with W=1.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9054 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-19 01:18:24 +00:00
Bart Van Assche
cf909e3e16 Makefiles: If both KDIR and KVER have been set, preserve KDIR
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9052 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-19 00:00:49 +00:00
Bart Van Assche
d6fd03107f Split Makefiles: move kernel build rules into Kbuild files
This patch makes the Makefiles easier to read.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9039 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-07-05 02:13:40 +00:00