Commit Graph
6745 Commits
Author SHA1 Message Date
Bart Van Assche 1cd44e93ad scst: Fix __scst_adjust_sg_get_tail()
Set *res_sg_cnt correctly in case the scatterlist is chained. Support chained
scatterlists in the loop that calculates the number of bytes left. Fix
restoring the original SG list in case an error happens:
scst_check_restore_sg_buff() only restores the original sg list if
cmd->sg_buff_modified has been set. However, __scst_adjust_sg_get_tail()
does not set that variable. This patch fixes the following kernel complaints
triggered by COMPARE AND WRITE (see also
https://github.com/bvanassche/scst/issues/22):

scst_adjust_sg_get_tail() failed: -22
WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/scst_lib.c:6860 scst_cwr_read_cmd_finished+0x954/0xb10 [scst]
CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G           O      5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:scst_cwr_read_cmd_finished+0x954/0xb10 [scst]
Call Trace:
 scst_finish_internal_cmd+0x1f8/0x3c0 [scst]
 scst_process_active_cmd+0x594/0x17f0 [scst]
 scst_cmd_thread+0x470/0xc30 [scst]
 kthread+0x211/0x240
 ret_from_fork+0x24/0x30

WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/../include/scst.h:5030 blockio_exec_rw+0xbb2/0xe00 [scst_vdisk]
CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G        W  O      5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:blockio_exec_rw+0xbb2/0xe00 [scst_vdisk]
Call Trace:
 blockio_exec_write+0x9c/0x160 [scst_vdisk]
 vdev_do_job+0xe8/0x290 [scst_vdisk]
 blockio_exec+0x153/0x4b0 [scst_vdisk]
 scst_do_real_exec+0xf4/0x680 [scst]
 scst_exec_check_blocking+0x24e/0x7b0 [scst]
 scst_exec_check_sn+0x252/0x7d0 [scst]
 scst_process_active_cmd+0x9a0/0x17f0 [scst]
 scst_cmd_thread+0x37e/0xc30 [scst]
 kthread+0x211/0x240
 ret_from_fork+0x24/0x30

BUG: KASAN: slab-out-of-bounds in __scst_adjust_sg_get_tail+0x2da/0x550 [scst]
Read of size 4 at addr ffff8881dd9b93cc by task disk011_0/1179

CPU: 3 PID: 1179 Comm: disk011_0 Tainted: G        W  O      5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
Call Trace:
 dump_stack+0xa5/0xe6
 print_address_description.constprop.0+0x46/0x60
 __kasan_report.cold+0x94/0xbb
 kasan_report+0x45/0x60
 __asan_load4+0x6f/0x90
 __scst_adjust_sg_get_tail+0x2da/0x550 [scst]
 scst_cwr_read_cmd_finished+0x574/0xb10 [scst]
 scst_finish_internal_cmd+0x1f8/0x3c0 [scst]
 scst_process_active_cmd+0x594/0x17f0 [scst]
 scst_cmd_thread+0x470/0xc30 [scst]
 kthread+0x211/0x240
 ret_from_fork+0x24/0x30

Allocated by task 1549:
 save_stack+0x23/0x50
 __kasan_kmalloc.constprop.0+0xcf/0xe0
 kasan_slab_alloc+0x12/0x20
 kmem_cache_alloc+0x101/0x370
 mempool_alloc_slab+0x1b/0x20
 mempool_alloc+0xf3/0x2b0
 sg_pool_alloc+0x58/0xb0
 __sg_alloc_table+0x14e/0x1c0
 sg_alloc_table_chained+0x4f/0xf0
 scsi_init_io+0x144/0x6d0 [scsi_mod]
 scsi_queue_rq+0xabc/0xe00 [scsi_mod]
 blk_mq_dispatch_rq_list+0x6ad/0xd10
 __blk_mq_sched_dispatch_requests+0x1e9/0x2c0
 blk_mq_sched_dispatch_requests+0x8e/0xc0
 __blk_mq_run_hw_queue+0x128/0x1e0
 __blk_mq_delay_run_hw_queue+0x2dd/0x310
 blk_mq_run_hw_queue+0x145/0x1e0
 blk_mq_sched_insert_request+0x236/0x360
 blk_execute_rq_nowait+0x8e/0xa0
 blk_execute_rq+0xe1/0x160
 sg_io+0x43b/0x7a0
 scsi_cmd_ioctl+0x27a/0x3e0
 scsi_cmd_blk_ioctl+0x83/0x95
 sd_ioctl_common+0xb6/0x150 [sd_mod]
 sd_ioctl+0x20/0x80 [sd_mod]
 blkdev_ioctl+0x1c3/0x3c0
 block_ioctl+0x87/0xa0
 ksys_ioctl+0x8e/0xd0
 __x64_sys_ioctl+0x47/0x50
 do_syscall_64+0x6f/0x310
 entry_SYSCALL_64_after_hwframe+0x49/0xb3


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8932 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 20:58:06 +00:00
Bart Van Assche edff6da84e scst: Introduce a new local variable in __scst_adjust_sg_get_tail()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8931 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 20:01:47 +00:00
Bart Van Assche b30634f6e0 scst: Improve scst_adjust_sg() documentation
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8930 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 19:57:13 +00:00
Bart Van Assche 54ccb1add2 scst: Fix a debug statement in __scst_adjust_sg()
Instead of printing the same 'sg' pointer in each iteration, print the sgi
pointer.

Fixes: commit 2755c02421 ("scst: Introduce for_each_sg() in scst_adjust_sg()") # v3.0.0 (r4910).



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8929 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 19:54:19 +00:00
Bart Van Assche 8276dc53d3 scstadmin: Make scstadmin again compatible with older Perl interpreters
Fix the following Perl v5.10.1 warnings:

Ambiguous use of -ENOENT resolved as -&ENOENT() at /usr/local/share/perl5/SCST/SCST.pm line ...

According to https://stackoverflow.com/questions/23215511/ambiguous-use-of-constant-resolved-as-constant
that message indicates a bug in the Perl interpreter.

Reported-by: Gilbert Standen <gilstanden@hotmail.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8928 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 16:43:13 +00:00
Bart Van Assche 4525b04b23 scst: Reject inconsistent COMPARE AND WRITE commands
Reject COMPARE AND WRITE commands if the size of the data buffer does not
match the number of logical blocks specified in the CDB. This patch makes
two more libiscsi conformance tests pass.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8927 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 16:02:32 +00:00
Bart Van Assche d5e13d6453 scst: Introduce a new local variable in scst_cmp_wr_local()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8926 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 16:01:00 +00:00
Bart Van Assche 981501a9fa scst.h: Remove an obsolete comment
This is a follow-up for commit 57d9df0717 ("scst: Remove an empty
function") / r8908.




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8925 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 15:59:30 +00:00
Bart Van Assche d9a684a9c3 scst.h: Add a comment above sg_next_inline()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8924 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 15:57:45 +00:00
Bart Van Assche c84dbccf5c scst: Complain loudly if scst_adjust_sg_get_tail() fails
Apparently certain libiscsi COMPARE AND WRITE tests cause
scst_adjust_sg_get_tail() to fail. Complain if that happens even if
"EXTRACHECKS" are disabled.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8923 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 15:57:21 +00:00
Bart Van Assche b07dea49d4 scripts/run-regression-tests: Do not create a -.o file
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8922 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 15:55:46 +00:00
Bart Van Assche 0736635b62 scripts/list-source-files: exclude build artifacts when not in vcs tree
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8921 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-16 15:54:19 +00:00
Bart Van Assche d12b0a0d91 Fix spelling in documentation and source code
See also https://github.com/bvanassche/scst/pull/20.

[ bvanassche: left out qla2x00t-32gbit changes and changed patch description ]



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8920 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-15 18:53:48 +00:00
Bart Van Assche b440f2b84f scripts/list-source-files: Use /bin/sh as interpreter instead of bash
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8919 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-15 18:53:18 +00:00
Bart Van Assche 8de9eb487a scstadmin: Fix -resync_dev
Fix the following failure:

    # scstadmin -resync_dev volume01
    Collecting current configuration: done.
            -> Making requested changes.
            -> WARNING: Device 'volume01' lacks the settable attribute 'resync_size', ignoring.
            -> Done.
    All done.

This patch fixes a regression that was introduced by r8171 (commit
aedcfc5997 ("scstadmin: Avoid that Perl complains about undefined values
for write-only attributes") # v3.4.

Reported-by: Marc Smith <msmith626@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8915 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-14 20:45:26 +00:00
Bart Van Assche d045ff5e26 srpt: Make zero-copy mode compatible with the scst_user device handler
The scst_user device handler allocates its own data buffers. If ib_srpt
uses zero-copy mode, copy data as required between the device handler and
zero-copy buffer.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8914 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-14 16:40:05 +00:00
Bart Van Assche 198cb64c8d scstadmin: Make test 06 more robust
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8913 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-14 16:37:18 +00:00
Bart Van Assche 29548a4ad7 scst: Remove the on_alua_state_change_*() callback functions
Remove these callback functions because:
- Since the introduction of the 'active' attribute, these callback functions
  are no longer essential. See also commit 9d21169f8c ("scst: implement
  BLOCKIO devices "active" attribute").
- The current implementation may break I/O. The following ALUA configuration
  is sufficient to break I/O (because a remote group with state 'standby'
  occurs last):

DEVICE_GROUP dgroup1 {
	DEVICE disk01

	TARGET_GROUP tgroup1 {
		group_id 256
		preferred 1
		state active
		TARGET scst_local_tgt
	}
	TARGET_GROUP tgroup2 {
		group_id 257
		state standby
		TARGET scst_local_tgt_remote {
			rel_tgt_id 7
		}
	}
}

See also commit 2b202209ca ("ALUA DRBD compatibility").



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8912 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-14 16:36:30 +00:00
Bart Van Assche 80d2dac38e vdisk_blockio: Remove support for unaligned buffers
Submitting an unaligned buffer is a bug. Additionally, the patch that added
support for unaligned buffers negatively affected performance of the ib_srpt
and scst_local drivers.

This patch reverts 85f8ac3a1e ("vdisk_blockio: Add support for unaligned
buffers").



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8911 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-14 16:27:32 +00:00
Bart Van Assche 7d63eaf0ce scstadmin: If modifying an SCST attribute fails, report why it fails
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8910 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-14 16:23:57 +00:00
Bart Van Assche 041ef55247 scripts/kernel-functions: Fix the RHEL 6.x build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8909 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-13 21:27:11 +00:00
Bart Van Assche 57d9df0717 scst: Remove an empty function
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8908 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-13 20:52:23 +00:00
Bart Van Assche bcdfc28dd8 iscsi-scst: Add a hint what to look for if no userspace process is connected
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
[ bvanassche: edited description and patch ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8907 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-13 20:48:12 +00:00
Bart Van Assche 115ec5be90 scripts/kernel-functions: Only apply RHEL patches on RHEL kernels
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8906 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-13 20:37:30 +00:00
Bart Van Assche 858f50e4d3 scstadmin: Improve robustness
Instead of only interpreting the empty string as "no argument passed", also
consider 'undef' as "no argument passed".


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8905 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-13 17:24:35 +00:00
Bart Van Assche ee0328f6f7 scst: Drop support for scst_register_target(..., NULL)
Support for autogenerated target names was declared obsolete in 2011. Remove
support for autogenerated target names. See also commit 21d503cbb7
("Autogenerated SCST target names made deprecated").


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8904 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-13 17:23:14 +00:00
Bart Van Assche 08ba5d8f1a iscsi-scst: Remove unnecessary %s format modifiers
See also https://github.com/bvanassche/scst/pull/18.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8903 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-12 14:57:00 +00:00
Bart Van Assche 95893200f2 scst_user: Fix a recently introduced coding style issue
See also commit b2facc91c9 ("scst/src/dev_handlers/scst_user: Simplify dev_user_reply_get_multi()").



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8902 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-12 01:04:32 +00:00
Bart Van Assche 58a1ea5bd7 scripts/generate-kernel-patch: Use read instead of readarray and fix shellcheck warnings
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8901 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-11 20:38:25 +00:00
Bart Van Assche 056f426165 scripts/kernel-functions: Make this script compatible with bash versions that do not support readarray
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8900 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-11 20:37:43 +00:00
Bart Van Assche 9429a9930f scripts/rhel-rpm-functions: Use ${...//...} instead of setting the IFS variable
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8899 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-11 20:36:04 +00:00
Bart Van Assche 04b4ee34fe scripts/run-regression-tests: Fix the CentOS 6.x build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8894 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 20:47:33 +00:00
Bart Van Assche f40d96c8a0 scripts/run-regression-tests: Make the CentOS build less noisy
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8893 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 19:00:39 +00:00
Bart Van Assche ab4f2f5077 scripts/generate-kernel-patch: Use the generic drivers Makefile for CentOS 6.x
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8892 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 18:59:38 +00:00
Bart Van Assche 30488c97b9 nightly/conf/nightly.conf: Add CentOS kernel versions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8891 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 18:39:34 +00:00
Bart Van Assche 8485b98f05 scripts/kernel-functions: Suppress RHEL warnings about module_init() / module_exit()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8890 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 18:38:58 +00:00
Bart Van Assche 676b1717fb scripts/specialize-patch: More bug fixes for RHEL / CentOS kernels
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8889 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 18:37:03 +00:00
Bart Van Assche 7b764b1499 fcst: Suppress sparse warnings
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8888 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 18:36:21 +00:00
Bart Van Assche 1195daa855 scripts/specialize-patch: Fix RHEL kernel version checks
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8887 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:56:56 +00:00
Bart Van Assche 24b832098b scst: Fix the build against a RHEL 8 debug kernel
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8886 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:55:21 +00:00
Bart Van Assche 6773f8e9a5 scripts/run-regression-tests: Add support for distro kernels
A few examples of how to run the regression tests against a distro kernel:

scripts/run-regression-tests -l 4.18.0-147.5.1.el8_1^CentOS^8.1.1911-nc
scripts/run-regression-tests -l 4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc
scripts/run-regression-tests -l 3.10.0-1127.el7^CentOS^7.8.2003-nc
scripts/run-regression-tests -l 3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc
scripts/run-regression-tests -l 3.10.0-957.27.2.el7^CentOS^7.6.1810-nc
scripts/run-regression-tests -l 3.10.0-862.14.4.el7^CentOS^7.5.1804-nc



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:54:47 +00:00
Bart Van Assche b3b658bd09 scripts/generate-kernel-patch: Make several paths absolute
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8884 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:48:23 +00:00
Bart Van Assche 24caf06381 scripts/rhel-rpm-functions: Add more URLs
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8883 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:47:45 +00:00
Bart Van Assche 5b1a15d3c9 scstadmin/init.d/scst: Simplify sed expressions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8882 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:46:59 +00:00
Bart Van Assche 17a0091804 scstadmin/init.d/scst: Fix shellcheck warnings
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8881 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 22:46:02 +00:00
Bart Van Assche 5400331606 scripts/rhel-rpm-functions: Restore this file by reverting r8111
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8880 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 19:38:33 +00:00
Bart Van Assche f4ce28b5ab scst/include/backport.h: Unbreak the build on RHEL 7 / CentOS 7
Fixes: 5ebd20d839 ("scst/include/backport.h: Backport cpu_to_be32_array()")


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8879 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 15:11:29 +00:00
Bart Van Assche 289ae036e5 qla2x00t-32gbit: Fix a compiler warning triggered by kernel versions before v4.10
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8878 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-09 15:11:05 +00:00
Bart Van Assche 5a99fa9a8c qla2x00t-32gbit: Move the trace/events/qla.h include file
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8877 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-08 15:32:10 +00:00
Bart Van Assche 9ece5279ad Add the qla2x00t-32gbit/trace/events/qla.h file to the output of scripts/generate-kernel-patch
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8876 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-08 15:23:43 +00:00