Also unload SCST kernel modules that have been loaded manually or that are
no longer referenced by /etc/scst.conf.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8951 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Instead of passing an scst_data_direction value to scst_scsi_execute(), pass
a dma_data_direction value.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8948 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Running fio at the initiator side with buffer size 1 MiB and when using
direct I/O triggers the following error with a ConnectX-3 and Linux kernel
v4.19 or later or CentOS 7.7 or later at the target side:
ib_srpt: RDMA t 4 for idx 20 failed with status 5. If this has not been triggered by a cable pull, please check the involved IB HCA's and cables.
This was observed with firmware version 2.42.5000 but this is probably
independent of the firmware version. Fix this by reducing the send SGE QP
limit. This patch increases ch->max_recv_sge for older kernel versions.
Reported-by: Chesnokov Gleb <Chesnokov.G@raidix.com>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8938 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The path_rec pointer is set for IB and RoCE logins but not for iWARP
logins. Hence check the path_rec pointer before dereferencing it.
See also upstream commit cbca2442a096 ("RDMA/srpt: Fix handling of iWARP
logins") # v5.5.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8934 d57e44dd-8a1f-0410-8b47-8ef2f437770f
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
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
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
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