Commit Graph

9222 Commits

Author SHA1 Message Date
Gleb Chesnokov
492b6ccbea scstadmin.spec: Install unit into %{_unitdir} and package it
Fixes: https://github.com/SCST-project/scst/issues/323
2025-11-05 11:41:41 +03:00
Ameer Hamza
6c73cc8d2f scst_lib: Port to Linux kernel v6.18
Support for the following block layer and memory management changes in
the Linux kernel v6.18:

  - d86eaa0f3c56 ("block: remove the bi_inline_vecs variable sized array
    from struct bio")
  - 84efbefa26df ("mm: remove nth_page()")
2025-10-30 11:02:08 +03:00
Brian M
0d3c9018af debian, scstadmin: Add systemd scst.service
Add systemd service file when packaging for Debian.  Current
systemd will automatically generate one, but this functionality
will be removed in a future version of systemd.
2025-10-28 18:15:04 +03:00
Gleb Chesnokov
08f5f43df8 fcst: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-10-21 12:18:36 +03:00
Gleb Chesnokov
dff8aedcaa scst_priv.h: Drop redundant 'extern' from function prototypes
This patch does not change any functionality.
2025-10-21 12:18:36 +03:00
Gleb Chesnokov
3928d6d74f iscsi-scst: Drop redundant 'extern' from function prototypes
This patch does not change any functionality.
2025-10-21 12:18:36 +03:00
Gleb Chesnokov
6a2b3e36e4 ib_srpt: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-10-21 12:18:36 +03:00
Gleb Chesnokov
3b6e2ed8be scst_local_cmd: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-10-21 12:18:36 +03:00
Gleb Chesnokov
6ca7f49b8c scst_tg: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-10-21 12:18:36 +03:00
Gleb Chesnokov
6543c4c316 qla2x00t-32gbit: Remove firmware URL
The historic QLogic firmware URL redirects to a Marvell page that only
provides drivers.

Refer to linux-firmware instead.

Cc: Nilesh Javali <njavali@marvell.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: QLOGIC ML <GR-QLogic-Storage-Upstream@marvell.com>
Cc: LINUX SCSI ML <linux-scsi@vger.kernel.org>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Link: https://lore.kernel.org/r/20250624190926.115009-1-xose.vazquez@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit b152f199fa43 upstream ]
2025-10-01 22:11:28 +03:00
Gleb Chesnokov
0e890f5167 scst: Indent Kconfig help text
Fix indentation of config option's help text by adding leading spaces.
Generally help text is indented by couple of spaces more beyond the leading
tab <\t> character.  It helps Kconfig parsers to read file without error.
2025-10-01 22:11:28 +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
Gleb Chesnokov
3960dc87ac qla2x00t-32gbit: Avoid stack frame size warning in qla_dfs
The qla2x00_dfs_tgt_port_database_show() function constructs a fake
fc_port_t object on the stack, which--depending on the configuration--is
large enough to exceed the stack size warning limit:

drivers/scsi/qla2xxx/qla_dfs.c:176:1: error: stack frame size (1392) exceeds limit (1280) in 'qla2x00_dfs_tgt_port_database_show' [-Werror,-Wframe-larger-than]

Rework this function to no longer need the structure but instead call a
custom helper function that just prints the data directly from the
port_database_24xx structure.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250620173232.864179-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 6243146bb019 upstream ]
2025-10-01 22:11:28 +03:00
Gleb Chesnokov
fae9d2a1e5 scst: Unbreak UEK and RHEL builds
Drop OL6/UEK R4 support.
2025-10-01 22:11:28 +03:00
Gleb Chesnokov
5245d1cb15 .github/workflows: Print compilation output and improve annotations
Show the kernel compilation output whenever the run reached the
compilation stage (both pass/fail cases) and add a readable prefix
with the actual filename. Also refactor to use variables for version,
workdir, and output; quote expansions; and switch to titled GitHub
Actions annotations. Drop `-k` and rely on explicit cleanup.
2025-10-01 22:11:28 +03:00
Gleb Chesnokov
59bdb2463c scripts/specialize-patch: treat "#if 0" and "#if 0 && ..." as constant-false
Partial evaluation can yield guards like "+#if 0 && ...". These are false
but bypassed the filter that only matched exact "+#if 0"/"+#elif 0".
Tighten the regex to match the original spacing and catch both forms.

This is the minimal change addressing the bug observed in logs such as:

  (c) +#if 0 && !(1 && defined(FC_PORTSPEED_256GBIT)) ...
  (g2) ... output = 1   <-- wrong

After this change such guards are dropped correctly (output = 0).
2025-10-01 22:11:28 +03:00
Gleb Chesnokov
9543060a2c scripts/generate-kernel-patch: Use krel for qla2xxx patch paths
Fix mismatch where generate-kernel-patch keyed paths by full_kver
(with ‘^’) but in-tree patches were written under krel
(before ‘^’). Derive krel=${full_kver/^*} and use it for qla2xxx path
resolution.
2025-09-30 18:09:11 +03:00
Gleb Chesnokov
90c26fa844 scripts/run-regression-tests: Drop 2.6.x paths and simplify builds
Always include drivers/scsi/qla2xxx in subdirs and extend the local
module build loop to cover both qla2x00t and qla2x00t-32gbit.
2025-09-30 18:09:11 +03:00
Gleb Chesnokov
8180623310 nightly build: Update kernel versions
Another kernel versions update
2025-09-30 12:13:22 +03:00
Gleb Chesnokov
420b06472b scst_event: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-09-23 13:24:49 +03:00
Gleb Chesnokov
c38b254c7a scst_mem: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-09-23 12:49:00 +03:00
Gleb Chesnokov
6e787cbefd scst_pres: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-09-23 11:41:48 +03:00
Gleb Chesnokov
10740bb400 scst_targ: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-09-16 14:19:05 +03:00
Gleb Chesnokov
5072f0ce58 scst_copy_mgr: Fix multiple checkpatch warnings
This patch does not change any functionality.
2025-09-09 12:21:23 +03:00
Tony Battersby
f8bfa638b6 scst: Export scst_tgt->sg_tablesize via sysfs
This value is available in initiator mode via
/sys/class/scsi_host/hostN/sg_tablesize; make it available in target
mode as well.  Userspace code may use it when making decisions about
buffer sizes.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2025-09-08 16:40:12 +03:00
Tony Battersby
70e0d81436 scst_user: Fix oops in SCST_USER_PARSE_EXCEPTION
If dev->generic_parse() detects a math overflow and calls
scst_set_cmd_error(), and scst_user is using SCST_USER_PARSE_EXCEPTION,
then it will trigger a sBUG() in scst_targ.c::scst_parse_cmd() where it
checks for a valid cmd->state:

scst: scst_parse_cmd:1385:***CRITICAL ERROR***: Bad state for completed cmd
(cmd 000000005abc21e1, state 1)
BUG at /usr/src/debug/scst/3.10+git/scst/src/scst_targ.c:1387

Fix by treating negative generic_parse() errors as final.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2025-09-08 16:40:12 +03:00
Tony Battersby
f9de3f4169 scst: Fix parsing of CDB control byte
SCST_GET_CDB_LEN() returns 0 for vendor-specific opcodes such as:

0xD1 READ DYN RUNTIME ATT
0xD2 WRITE DYN RUNTIME ATTR
0xE7 INIT ELEMENT STATUS WRANGE

This causes scst_set_cmd_from_cdb_info() to check cdb[-1] for the
control byte, causing an out-of-bounds array read.

- Move the parsing of the control byte after get_cdb_info() since that
  may set the CDB length to a known value.

- If the CDB length is still unknown, then assume the control byte is
  0 without accessing the CDB.

- Check for variable-length CDBs in scst_set_cmd_from_cdb_info() rather
  than using the wrong control byte and then overriding it in
  get_cdb_info_var_len().  This is necessary because the override would
  no longer work after the change above.

Also, the following code doesn't work:

    #define CONTROL_BYTE_NACA_BIT 0x04
    unsigned int cmd_naca:1;
    cmd_naca = (control & CONTROL_BYTE_NACA_BIT);

The result will always be 0.  Use this instead:

    cmd_naca = !!(control & CONTROL_BYTE_NACA_BIT);

(cmd_linked happened to work because CONTROL_BYTE_LINK_BIT is 0x01, but
apply the same fix there also for consistency).

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2025-09-08 16:40:12 +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
Tony Battersby
189ab46a97 scst: Fix garbage in trace_level files
'hd /sys/kernel/scst_tgt/trace_level' shows a series of extraneous nul
chars at the end of the first line.

Fixes: 9cbca53830 ("scst: Replace sprintf() with scnprintf() in sysfs callbacks")
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2025-09-08 16:40:12 +03:00
dkambleNetapp
1b78d5076d INSTALL.md: Add 'which' as build dependency
Update INSTALL.md to list 'which' as a required dependency.
Without it, scst init script fails with:

    /etc/init.d/scst: line 149: which: command not found

as seen in systemd logs:

    mp-scst-service scst[1198]: /etc/init.d/scst: line 149: which: command not found
    mp-scst-service systemd[1]: mp-scst.service: Control process exited, code=exited, status=1/FAILURE

Stemming from the line:
https://github.com/SCST-project/scst/blob/v3.9/scstadmin/init.d/scst#L162
2025-09-08 15:30:18 +03:00
Gleb Chesnokov
1ba89c391e iscsi-scst: Accept CRC32 or LIBCRC32C for crc32c() across kernels
Kernel v6.15+ removed LIBCRC32C and switched in-tree users to CRC32.
Keep older kernels working by accepting either CRC32 or LIBCRC32C in
Kconfig and preprocessor guards, so crc32c() usage compiles and links
on both old and new kernels.
2025-08-18 13:23:30 +03:00
Gleb Chesnokov
314659ed7c scstadmin: Normalize SCST version parsing in SCST.pm
scstadmin's version check assumed scstVersion() returns a bare "X.Y.Z".
After changing the sysfs attribute it may return strings like
"SCST version: 3.10.0-pre", which triggered a numeric warning and a
false failure:

  Argument "SCST version: 3" isn't numeric in numeric gt (...)

Parse the version number from the raw string and ignore any
prefix/suffix. If no version can be parsed, keep the existing
failure path.

Fixes: https://github.com/SCST-project/scst/issues/296
2025-08-18 11:45:57 +03:00
Gleb Chesnokov
d0b970fad0 qla2x00t-32gbit: Fix DMA mapping test in qla24xx_get_port_database()
dma_map_XXX() functions return as error values DMA_MAPPING_ERROR which is
often ~0.  The error value should be tested with dma_mapping_error() like
it was done in qla26xx_dport_diagnostics().

Fixes: 818c7f87a177 ("scsi: qla2xxx: Add changes in preparation for vendor extended FDMI/RDP")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://lore.kernel.org/r/20250617161115.39888-2-fourier.thomas@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit c3b214719a87 upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
06f8d870a3 qla2x00t-32gbit: Remove duplicate struct crb_addr_pair
In preparation for making the kmalloc family of allocators type aware, we
need to make sure that the returned type from the allocation matches the
type of the variable being assigned. (Before, the allocator would always
return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct crb_addr_pair *" and the returned type will
be a _different_ "struct crb_addr_pair *", causing a warning. This really
stumped me for a bit. :) Drop the redundant declaration.

Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250426061951.work.272-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 386e014202f8 upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
5e3c7eaf27 qla2x00t-32gbit: Remove unused module parameters
ql2xetsenable last use was removed in 2020 by commit 37efd51f75f3 ("scsi:
qla2xxx: Use FC generic update firmware options routine for ISP27xx")

ql2xiidmaenable last use was removed in 2017 by commit 726b85487067
("qla2xxx: Add framework for async fabric discovery")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-9-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 3a37ab0827fd upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
61d96b8b93 qla2x00t-32gbit: Remove unused qla2x00_gpsc()
qla2x00_gpsc() was added in 2017 as part of commit 726b85487067
("qla2xxx: Add framework for async fabric discovery") but has remained
unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-8-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 45838d3db750 upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
07f82d9505 qla2x00t-32gbit: Remove unused ql_log_qp
ql_log_qp() was added in 2017 as part of commit 22d84726e3b8 ("scsi:
qla2xxx: Add debug logging routine for qpair") but has remained unused.

Remove it. (That patch also added ql_dbg_qp but that is still used so is
left in).

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-7-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 33f44a50ca61 upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
4db857c081 qla2x00t-32gbit: Remove unused qla82xx_wait_for_state_change()
qla82xx_wait_for_state_change() was added in 2010 as part of commit
579d12b58abb ("[SCSI] qla2xxx: Added support for quiescence mode for
ISP82xx.")  but has remained unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-6-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 2a2f3168c510 upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
42bb0fb1de qla2x00t-32gbit: Remove unused qla82xx_pci_region_offset()
qla82xx_pci_region_offset() has been unused since the last use was
removed by 2010's commit 3711333dfbee ("[SCSI] qla2xxx: Updates for
ISP82xx.")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-5-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 89981b47f6fc upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
3b945f84be qla2x00t-32gbit: Remove unused qlt_83xx_iospace_config()
qlt_83xx_iospace_config() has been unused since the last use was removed
by 2017's commit f54f2cb540b5 ("scsi: qla2xxx: Cleaned up queue
configuration code.")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-4-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 91453ebecccc upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
0d2807eff3 qla2x00t-32gbit: Remove unused qlt_fc_port_deleted()
qlt_fc_port_deleted() has been unused since the last use was removed by
2017's commit 726b85487067 ("qla2xxx: Add framework for async fabric
discovery")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-3-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit cbb2a2ef5801 upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
4bad58a3d3 qla2x00t-32gbit: Remove unused qlt_free_qfull_cmds()
qlt_free_qfull_cmds() was added in 2014 as part of commit 33e799775593
("qla2xxx: Add support for QFull throttling and Term Exchange retry") but
has remained unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-2-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit ae7a08bee82b upstream ]
2025-08-05 18:15:49 +03:00
Gleb Chesnokov
1186ac25c5 nightly build: Update kernel versions
Another kernel versions update
2025-08-05 17:41:32 +03:00
Gleb Chesnokov
2631557383 scst.spec.in: Replace custom Requires line with package names
The scst.spec.in file used a custom Requires line that dynamically resolved
the full paths of the find and rm commands using shell substitution with
'which'. This method is non-standard and can lead to issues in constrained
build environments.

This patch replaces the custom Requires line with explicit package names:
'findutils' for find and 'coreutils' for rm. This improves compatibility
and aligns with best practices for declaring dependencies in spec files.
2025-08-05 16:37:31 +03:00
Gleb Chesnokov
974b31fdcb scst: Port to Linux kernel v6.16
Support for the following timer changes in the Linux kernel v6.16:

- 41cb08555c41 ("treewide, timers: Rename from_timer() to timer_container_of()")
2025-08-05 16:37:31 +03:00
Gleb Chesnokov
c6d16dd86e qla2x00t, qla2x00t-32gbit: Constify 'struct bin_attribute'
The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.
2025-08-05 16:37:31 +03:00
Gleb Chesnokov
f85736549a iscsi-scst: Remove access to page->index
There is no need to print out page->index as part of the debug message.
2025-08-05 16:37:31 +03:00
Christoph Böhmwalder
3aad61d2fd iscsi-scst: use /run instead of /var/run
When attempting to manage iscsi-scstd using a systemd service file,
systemd warns:

PIDFile= references a path below legacy directory /var/run/, [...]

Change the pidfile path to be under /run instead.

/run has been in use as a replacement for /var/run for many years now
(the original Debian proposal is from 2011). Most distributions symlink
/var/run to /run, which means that this change should not have any
adverse side effects for the vast majority of users.
2025-06-26 15:11:58 +03:00
Gleb Chesnokov
17eb80e049 nightly build: Add RHEL 10 kernel support
Add AlmaLinux 10.0 kernel to nightly build configs and update helper
scripts to handle AlmaLinux 10.0 package sources.
2025-06-06 12:31:21 +03:00
Gleb Chesnokov
02167c4028 scst.h: Fix RHEL 9 build
Fixes: https://github.com/SCST-project/scst/issues/294
2025-06-06 12:31:21 +03:00