Commit Graph

7670 Commits

Author SHA1 Message Date
Bart Van Assche
d51093caac Merge branch 'svn-trunk' 2020-05-19 15:14:44 -07:00
Bart Van Assche
27ab15f573 ib_srpt: Use kvmalloc() instead of vmalloc()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8941 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:14:31 +00:00
Bart Van Assche
de74677c56 ib_srpt: Remove two superfluous assignments
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8940 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:13:11 +00:00
Bart Van Assche
b2536f47cf ib_srpt: Reduce QP max_recv_sge to 1
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8939 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:05:51 +00:00
Bart Van Assche
5290f39d78 Merge branch 'svn-trunk' 2020-05-19 12:21:39 -07:00
Bart Van Assche
543989b3a2 ib_srpt: Prevent that large RDMA transfers trigger QP termination
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
2020-05-19 19:21:26 +00:00
Bart Van Assche
1163f88c1d Merge branch 'svn-trunk' 2020-05-18 07:21:56 -07:00
Bart Van Assche
3f03d1e961 scst: Fix a recently introduced spelling error in a source code comment
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8937 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-18 14:17:00 +00:00
Bart Van Assche
4683786cf9 Merge branch 'svn-trunk' 2020-05-17 14:07:28 -07:00
Bart Van Assche
e3f76c80a5 qla2x00t-32gbit: Only use 'pragma GCC diagnostic' if supported by gcc
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8936 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 21:06:37 +00:00
Bart Van Assche
fa4383ce03 scst: Document __scst_create_prepare_internal_cmd()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8935 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 21:04:03 +00:00
Bart Van Assche
21edb121be ib_srpt: Fix handling of iWARP logins
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
2020-05-17 21:02:43 +00:00
Bart Van Assche
5529400fd5 .gitignore: Add built-in.a
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8933 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 20:58:38 +00:00
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
f2a86dbfb8 Merge branch 'svn-trunk' 2020-05-16 09:02:38 -07: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
d53deb3372 Merge branch 'svn-trunk' 2020-05-16 08:54:53 -07: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
Ville Skyttä
e9202cb257 scripts/list-source-files: exclude build artifacts when not in vcs tree 2020-05-16 08:53:59 -07:00
Bart Van Assche
5243ff47dd Merge branch 'svn-trunk' 2020-05-15 11:53:56 -07: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
Ville Skyttä
c9ea63d0f2 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 ]
2020-05-15 11:50:01 -07:00
Bart Van Assche
f31c03a0cc scripts/list-source-files: Use /bin/sh as interpreter instead of bash 2020-05-15 11:49:06 -07:00
Bart Van Assche
77c786af7d Merge branch 'svn-trunk' 2020-05-14 13:48:27 -07: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
3b9d078113 Merge branch 'svn-trunk' 2020-05-14 09:40:28 -07: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
c6da74b1a7 Merge branch 'svn-trunk' 2020-05-13 14:27:20 -07: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
12a94137ca Merge branch 'svn-trunk' 2020-05-13 13:52:37 -07: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
b1687999ba Merge branch 'svn-trunk' 2020-05-13 13:48:41 -07: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
c91c6d5e1f Merge branch 'svn-trunk' 2020-05-13 13:46:56 -07:00
Konstantin Kharlamov
054c738f63 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 ]
2020-05-13 13:46:41 -07:00
Konstantin Kharlamov
af1dfc9873 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-13 13:46:20 -07:00