Apparently RHEL 8 / CentOS 8 create soft links in the weak-modules to SCST
directory but do not update these links correctly after having upgraded to
a newer kernel version and after having reinstalled SCST. Hence remove all
weak module links before installing SCST.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9033 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Apparently the Linux kernel v4.20 iov_iter_kvec() function has been
backported to RHEL / CentOS 8.2. This patch fixes the following kernel
warning:
WARNING: CPU: 26 PID: 21141 at lib/iov_iter.c:1083 iov_iter_kvec+0x25/0x30
Call Trace:
fileio_exec_async+0x216/0x3a0 [scst_vdisk]
fileio_exec_write+0x3b9/0x450 [scst_vdisk]
vdev_do_job+0x34/0xc0 [scst_vdisk]
scst_do_real_exec+0x54/0x100 [scst]
scst_exec_check_blocking+0xbb/0x210 [scst]
scst_process_active_cmd+0x64d/0x1550 [scst]
scst_cmd_thread+0x170/0x5a0 [scst]
kthread+0x112/0x130
ret_from_fork+0x35/0x40
See also https://github.com/bvanassche/scst/issues/26.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9026 d57e44dd-8a1f-0410-8b47-8ef2f437770f
$(KBUILD_EXTRA_SYMBOLS) is not only used at compile time but also at link
time. Move the $(KBUILD_EXTRA_SYMBOLS) definitions such that it is
available both at compile time and at link time.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9000 d57e44dd-8a1f-0410-8b47-8ef2f437770f
While $(src) is always defined, $(KBUILD_EXTMOD) is only defined when
building code as an external module.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8999 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Flag RQF_COPY_USER has been removed from kernel v5.8. Since that flag
only controls padding that we don't need, do not set that flag. See also
Linux kernel commit f18573abcc57 ("block: move the padding adjustment to
blk_rq_map_sg") # v2.6.26.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8955 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
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
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
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
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
This patch does not change the behavior when using one of the vdisk handlers.
When using dev_disk to forward SCSI commands from one SCST node to another,
this patch causes RTPG and STPG commands to be processed on the source SCST
node (as it should) instead of on the destination SCST node.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8778 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make forwarding source mode configurable per target port instead of
having a compile-time global option.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8776 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Add the 'forward_dst' sysfs attribute next to the 'forwarding' attribute. The
plan is to remove the 'forwarding' attribute at some time in the future.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8775 d57e44dd-8a1f-0410-8b47-8ef2f437770f
__bitmap_parse() has been removed from kernel v5.6. See also commit
2d6261583be0 ("lib: rework bitmap_parse()") # v5.6-rc1.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8772 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Since the scst_targ.c source file is large, move the functions for processing
SCSI commands into a new source file, scst_local_cmd.c.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8768 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This patch suppresses the following Coverity complaint:
CID 119689 (#1 of 1): Out-of-bounds access (OVERRUN)
overrun-buffer-arg: Overrunning struct type scst_event of 64 bytes by
passing it to a function which accesses it at byte offset 3135 using
argument 64UL + payload_len (which evaluates to 3136). [Note: The source
code implementation of the function has been overridden by a builtin model.]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8760 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Designated initializers are required for GCC to safely implement
RANDSTRUCT, a GCC plugin pulled from the Grsecurity patch set
upstream ~2017.
Fix the compile error caused by implementation of sys_alloc_fns
by rewriting the struct with designated members.
See also https://github.com/bvanassche/scst/pull/17.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8759 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This patch prevents that the following warning is reported when running the
libiscsi tests against the vdisk_blockio handler:
Refused bio with invalid length 4080 and/or offset 16.
WARNING: CPU: 3 PID: 16022 at /home/bvanassche/software/scst.git/scst/src/dev_handlers/scst_vdisk.c:6180 blockio_exec_rw+0xc89/0xcf0 [scst_vdisk]
Call Trace:
blockio_exec_write+0x9c/0xe0 [scst_vdisk]
vdev_do_job+0xe8/0x220 [scst_vdisk]
blockio_exec+0x140/0x370 [scst_vdisk]
scst_do_real_exec+0xf4/0x610 [scst]
scst_exec_check_blocking+0x24e/0x6b0 [scst]
scst_exec_check_sn+0x222/0x6c0 [scst]
scst_process_active_cmd+0xdff/0x31c0 [scst]
scst_cmd_thread+0x36f/0xb60 [scst]
kthread+0x1bc/0x210
ret_from_fork+0x24/0x30
See also https://github.com/sahlberg/libiscsi/issues/302.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8700 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Since this function is only used by the vdisk_fileio handler, reflect this
in the function name.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8699 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The exec_req_fifo patches have been removed some time ago. Hence also remove
the code that depends on these patches having been applied. See also commit
78d6da4517 ("scst: Remove obsolete exec_req_fifo kernel patches"; r8022).
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8698 d57e44dd-8a1f-0410-8b47-8ef2f437770f