82 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
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
60dc638b1b iscsi-scst: Fix multiple checkpatch warnings
This patch does not change any functionality.
2024-11-16 14:33:58 +03:00
Chesnokov Gleb
41943ed156 iscsi-scst: 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
Bart Van Assche
d1f7b0aae8 iscsi-scst: Fix multiple checkpatch warnings
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8050 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-11 03:57:09 +00:00
Bart Van Assche
08e532715d Remove procfs support
Since all RHEL/CentOS 5 users have upgraded to a newer version, procfs
support is no longer necessary. Hence remove procfs support. This patch
has been generated as follows:

git grep -lw CONFIG_SCST_PROC iscsi-scst qla2x00t scst scst_local srpt |\
  while read f; do
    echo ${f}
    unifdef -U CONFIG_SCST_PROC ${f} >${f}.out
    mv ${f}.out ${f}
  done

followed by two small manual edits in scst/include/scst.h and also in
qla2x00t/qla2x00-target/qla2x00t.c.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7999 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-02 20:04:25 +00:00
Bart Van Assche
e2a17c6a24 Change 'long long int' int 'long long'
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7505 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-10-14 03:57:53 +00:00
Vladislav Bolkhovitin
f549829482 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7396 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-04-12 03:49:10 +00:00
Vladislav Bolkhovitin
41a287734f iscsi-scst: fix a couple of bad-function-cast warnings
This is a "marginal" warning, but there are only six of them in the SCST code
and this fixes two of those.

session.c:105:4: warning: cast from function call of type void * to non-matching type _Bool [-Wbad-function-cast]
target.c:668:14: warning: cast from function call of type void * to non-matching type _Bool [-Wbad-function-cast]

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7200 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-01 03:53:08 +00:00
Bart Van Assche
642744c9fc Fix spelling of "Ardis Technologies"
Reference: http://www.ddpsan.com/support-sales/about-us.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7165 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-02 22:32:06 +00:00
Bart Van Assche
0c83846917 Surround #include <linux/version.h> with #ifndef INSIDE_KERNEL_TREE / #endif
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7157 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-01 20:26:08 +00:00
Vladislav Bolkhovitin
68fa7e1a0d Copyright updates
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-22 03:19:52 +00:00
Vladislav Bolkhovitin
2331e8ec33 Thre is potential buffer overflow in iscsi_session_alloc() due to
short computation of needed string size.  Notice the "%s@%s" in the first call
to sprintf().

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7110 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:02:18 +00:00
Vladislav Bolkhovitin
c9b301bf39 iscsi-scst: add per_sess_dedicated_tgt_threads attribute in ini groups
If this attrubute is set, each iSCSI session for this initiator has
dedicated, i.e. not shared with other sessions, pool of the iscsi{wr,rd}
kernel threads.

Useful to control per-session CPU affinity to improve performance.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7069 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:00:43 +00:00
Vladislav Bolkhovitin
fa2f54ac9e Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6787 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-01-22 04:04:43 +00:00
Bart Van Assche
7614eafd64 iscsi-scst: Insert a blank line after declarations
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6616 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-11-07 00:00:42 +00:00
Bart Van Assche
58cfc4f8b8 iscsi: Only use thread pool for TCP but not for iSER
Signed-off-by: Yan Burman <yanb@mellanox.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6480 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-08-25 21:39:39 +00:00
Vladislav Bolkhovitin
45d7f40ec1 Improve release logging
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6478 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-08-25 02:57:51 +00:00
Bart Van Assche
79c8bf1f7c iscsi-scst, isert-scst: One trace flags variable per kernel module
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6397 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-23 15:01:17 +00:00
Vladislav Bolkhovitin
fe38e4acb2 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-03-19 00:01:03 +00:00
Bart Van Assche
9707f85c0b Fix kernel 3.17 checkpatch warnings about 'long long unsigned'
Avoid that checkpatch reports the following warning:

WARNING: type 'long long unsigned' should be specified in 'unsigned long long' order.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-11-26 08:16:44 +00:00
Vladislav Bolkhovitin
827e5b1461 scst, iscsi-scst: Add thread_pid attribute
For SCST devices with a short name determining which SCST command
threads serve a given LUN requires an (expensive) walk of the
process table. For SCST devices with a long name it is not possible
to determine unambiguously which command threads serve a given
LUN. Hence add a thread_pid sysfs attribute that makes it easy to
figure out which command threads serve a LUN.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5851 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-10-17 02:35:01 +00:00
Bart Van Assche
a2b88e7894 Fix a kernel 3.16 checkpatch complaint about trailing semicolons
Avoid that the checkpatch tool included in Linux kernel v3.16 reports the
following warning:

    macros should not use a trailing semicolon

This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5724 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-08-22 07:19:55 +00:00
Vladislav Bolkhovitin
6b32f4ae81 scst, iscsi-scst: Fix RHEL 5 compilation warnings
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5615 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-06-20 04:03:40 +00:00
Vladislav Bolkhovitin
97167af582 scst: Make lockdep_assert_held() easier to use
The lockdep_assert_held() macro is a convenient debugging tool.
However, it is inconvenient to surround each invocation of that
macro by an #ifdef/#endif pair. Hence make it easier to use this
macro with older kernel versions.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5573 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-06-06 03:26:55 +00:00
Vladislav Bolkhovitin
00851a7501 Merge of adding iSER web page and copyright updates from the iSER branch
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5241 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-28 05:17:26 +00:00
Vladislav Bolkhovitin
65d1b76e50 iscsi-scst: Make locking requirements explicit
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5101 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-13 04:51:05 +00:00
Vladislav Bolkhovitin
2093dd7561 Make it possible to forcibly close SRP and FC sessions via sysfs
That patch contains the following changes:
* Move the code for creating a "close_sess" sysfs attribute from iscsi-scst to
  the SCST core such that it becomes available for other target drivers. This
  does not change the functionality of iscsi-scst.
* Add code in ib_srpt and qla2x00t to allow a session to be forcibly closed from
  user space.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4852 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-18 00:52:46 +00:00
Vladislav Bolkhovitin
2cadcc2c64 Cache alignment review
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4809 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-23 01:38:31 +00:00
Vladislav Bolkhovitin
b9c0b9d92d Another micro-optimization: cache align all fast path structures
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4785 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-04 23:51:16 +00:00
Vladislav Bolkhovitin
10ca1d2f20 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4767 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-02-20 02:05:29 +00:00
Vladislav Bolkhovitin
eb4f05aafe This patch addresses a minor stylistic issue: use the value
returned by mutex_lock_interruptible() instead of explicitly
assigning -EINTR to res.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4481 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-27 20:42:58 +00:00
Vladislav Bolkhovitin
eb95049061 Copyrights updated + cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4216 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-04-18 02:26:39 +00:00
Vladislav Bolkhovitin
9da517bae1 Update for kernel 3.2. Netlink part in iSCSI-SCST done by Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4077 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-01-18 23:48:02 +00:00
Vladislav Bolkhovitin
f3238333dd Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3200 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-01-06 20:02:04 +00:00
Vladislav Bolkhovitin
ff2c24c1c3 Assigning CPU affinity to threads and connections
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2317 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-09-30 18:07:27 +00:00
Vladislav Bolkhovitin
b53e4cb4c1 Merge of the pr branch with additional fixes for problems found during extra testing
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1714 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-05-26 17:46:46 +00:00
Vladislav Bolkhovitin
bc1cda46df Sparse cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1713 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-05-24 12:32:45 +00:00
Vladislav Bolkhovitin
5406a07d26 Various iSCSI initiators access control and visibility improvements. Particularly:
- SendTargets now returns all (allowed) portals. Particularly based on IET r230, 234, 249 and 264.
 - Initiators assigned to security groups without LUNs will not see the target during discovery and forbidden to login to it
 - Per portals access control added
 - Negative sign added to wildcard matching
 - Docs updated
 - Cleanups and minor fixes



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1685 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-05-07 18:08:52 +00:00
Vladislav Bolkhovitin
4d5aaf047b Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1585 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-04-06 08:57:48 +00:00
Bart Van Assche
53a9bad357 Fixed several compiler and checkpatch warnings.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1568 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-03-27 08:46:06 +00:00
Vladislav Bolkhovitin
4d96089e50 Sysfs interface for targets made uniform. ISCSI-SCST made confirming the uniformity requirements. See README for details.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1511 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-02-17 19:07:54 +00:00
Vladislav Bolkhovitin
05d1bbfedc A huge chunk of related to each other changes, which had to be tested together.
iSCSI-SCST: A huge improvements in errors recovery and iSCSI RFC complaince as well as performance. Also:

 - Fixes and improvements for MaxOutstandingR2T>1

 - Flow control tracing added.

 - Cleanups

SCST core:

 - Now for scst_cmd_init_stage1_done() commands preprocessing_done() is always called before xmit_response(), even in case of abort or error.

 - Fixed recently introduced bug, which can lead to sending responses for aborted commands after reply on the corresponding TM command already sent.

 - Flow control tracing added.

 - Now it is possible to call functions setting commands execution status (e.g., scst_set_cmd_error_status()) several times for the same command. Only the first call will be completed, other calls - ignored.

 - All commands are counted and shown in proc/sysfs now. Before only active, i.e. not yet executed commands, were counted and shown there.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1431 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-01-06 13:02:22 +00:00
Bart Van Assche
cdbd65daeb Removed trailing whitespace.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1313 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-11-03 07:46:39 +00:00
Vladislav Bolkhovitin
3af8bc9a4c Various sysfs related fixes
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1309 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-11-02 18:07:54 +00:00
Vladislav Bolkhovitin
977a20ccba ISCSI target sysfs implementation, except "enabled" attribute.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1305 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-10-30 20:15:38 +00:00
Vladislav Bolkhovitin
82b04b2a00 Merge of the sysfs branch. To enable the sysfs interface you should run "make disable_proc". To switch back on the procfs interface you should run "make disable_proc".
The sysfs intarface is mostly finished. Only initiators-oriented access control not implemented and not all target drivers are updated. Only qla2x00t has been fully updated.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1229 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-10-21 16:49:52 +00:00
Vladislav Bolkhovitin
cc83f517ea - Fix for a possible DoS, when misbehavine scst_user's handler hangs several memory allocations (= count of iSCSI read threads) and by so prevents other sessions from being served correctly. Spotted by Erez Zilber <erezzi.list@gmail.com>
- iSCSI read state machine cleanups

 - Fix a race when just freed iSCSI session accessed, because the corresponding SCST session is still being unregistered.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1224 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2009-10-15 15:56:57 +00:00