Commit Graph

556 Commits

Author SHA1 Message Date
Bart Van Assche
9df67df132 iscsi-scst: Fix 32-bit compiler warnings
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7910 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-02-08 03:43:35 +00:00
Bart Van Assche
bf3f677040 isert-scst: Fix sparse warnings related to poll functions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7837 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-11-28 06:39:48 +00:00
Bart Van Assche
df02132689 iscsi-scst: Remove the no longer supported put_page_callback patches
See also trunk r7809.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7811 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-11-17 22:31:57 +00:00
Bart Van Assche
5a1474df43 scst, iscsi-scst: Port to Linux kernel v4.20
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7810 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-11-10 17:51:41 +00:00
Bart Van Assche
e79fcbd8f3 iscsi-scst: Remove zero-copy TCP/IP support
Zero-copy TCP/IP support is deprecated since a while and is no longer
supported for recent kernels. Hence remove it and also all references
to zero-copy TCP/IP support.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7809 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-11-10 17:50:59 +00:00
Bart Van Assche
9fff6bc1f0 iscsi-scst: Declare cmnd_alloc() static
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7808 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-11-10 17:48:33 +00:00
Bart Van Assche
78a0407d0e scst, iscsi-scst: Simplify the code that uses kstrto*l()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7522 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-10-14 22:05:33 +00:00
Bart Van Assche
93d7c0da08 Expand Kconfig help texts
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7518 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-10-14 21:59:08 +00:00
Bart Van Assche
c59b0a2303 iscsi-scst: Insert spaces after comma's where required according to the coding style
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7517 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-10-14 21:58:38 +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
Bart Van Assche
7d13a9430e isert-scst: Port to Linux kernel v4.19
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7472 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-08-27 03:20:51 +00:00
Bart Van Assche
6dc06a3cde scst, isert-scst: Revert the temporary kernel v4.16 workarounds
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7449 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-08-01 04:44:20 +00:00
Bart Van Assche
4c01448dfa iscsi-scst: Simplify iscsi_get_initiator_port_transport_id()
From the snprintf() man page:
    
If n is zero, nothing shall be written and s may be a null pointer.

This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7435 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-07-23 04:23:26 +00:00
Bart Van Assche
687d0a734c isert-scst: Rework r7429
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7430 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-07-21 16:43:33 +00:00
Bart Van Assche
27354d06e9 isert-scst: Allow copying between userspace and isert_cmnd data structures
This patch avoids that the kernel reports the following:

kernel: usercopy: Kernel memory exposure attempt detected from SLUB object 'isert_cmnd' (offset 208, size 48)!

Reported-by: Carsten Aulbert <carsten.aulbert@aei.mpg.de>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7429 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-07-21 05:06:35 +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
Bart Van Assche
52e6f307b9 iscsi-scst: Fix spelling in a source code comment
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7340 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-01-18 05:57:05 +00:00
Vladislav Bolkhovitin
ca9debd891 iscsi-scst: fix a subtle race inside the EXTRACHECKs facility.
The system is running an iSCSI write test with header and data digests
enabled. On the command that resulted in the assert, all of the write
data was sent as immediate and unsolicited. The unsolicited data
consisted of a single DataOut PDU and it was the iscsi_cmnd resource
allocated for receiving the unsolicited DataOut that caused the assert,
not the iscsi_cmnd resource tracking the iSCSI write command. As the
Recv thread is finishing up with the iscsi_cmnd struct for receiving the
final unsolicited DataOut, SCST is call  the  iscsi_pre_exec function to
restart the command and this routine will process the DataOut
iscsi_cmnd as it is queued onto the rx_digest_list of the iscsi_cmnd for
Write.

ffff8a984150c600 is the iscsi_cmnd allocated to track the iSCSI Write command
ffff8a984150d680 is the iscsi_cmnd allocated for receiving the Data-out PDU

In the logs below, recv thread 3677 just completed receiving the unsolicited DataOut.

[  977.563046] [3677]: do_recv:808:nr_segs 0, bytes_left 0, res 196608
[  977.563048] [31728]: iscsi_make_conn_rd_active:351:conn ffff8a97d0df1600, rd_state 2, rd_data_ready 1
[  977.563065] [3677]: do_recv:808:nr_segs 0, bytes_left 0, res 4
[  977.563069] [31728]: iscsi_make_conn_rd_active:351:conn ffff8a97d0df1600, rd_state 2, rd_data_ready 1
[  977.563076] [3677]: cmnd_rx_end:3475:cmnd ffff8a984150d680, opcode 5
[  977.563078] [31728]: iscsi_make_conn_rd_active:351:conn ffff8a97d0df1600, rd_state 2, rd_data_ready 1
[  977.563081] [3677]: cmnd_rx_end:3478:Updated last_rcv_time 4295644274
[  977.563091] [3677]: data_out_end:2455:cmnd ffff8a984150d680, req ffff8a984150c600
[  977.563093] [3677]: cmd_add_on_rx_ddigest_list:820:Adding RX ddigest cmd ffff8a984150d680 to digest list of req ffff8a984150c600
[  977.563096] [3677]: cmnd_get:764:cmnd ffff8a984150d680, new cmnd->ref_cnt 2

Here we see no more data is pending to be received on this write, so
iscsi_restart_cmnd is called by recv thread which should trigger SCST to
start processing the command:

[  977.563106] [3677]: data_out_end:2495:req ffff8a984150c600, FINAL 80, outstanding_r2t 0, r2t_len_to_receive 0, r2t_len_to_send 0
[  977.563108] [3677]: req_del_from_write_timeout_list:141:Deleting cmd ffff8a984150c600 from conn ffff8a97d0df1600 write_timeout_list
[  977.563111] [3677]: cmnd_remove_data_wait_hash:1606:Deleting cmnd ffff8a984150c600 from the hash (ITT 1e230400)

SCST thread 24654 calls the pre execute routine which verifies the data
digest on immediate and unsolicited data:

[  977.563157] [24654]: iscsi_pre_exec:1917:Checking digest of RX ddigest cmd ffff8a984150c600
[  977.563161] [24654]: digest_data:125:req ffff8a984150c600, idx 0, count 16, sg_cnt 64, size 65536, offset 0
[  977.563170] [24654]: digest_rx_data:219:RX data digest OK for cmd ffff8a984150c600
[  977.563173] [3677]: cmnd_put:775:cmnd ffff8a984150c600, new ref_cnt 2
[  977.563176] [24654]: cmd_del_from_rx_ddigest_list:830:Deleting RX digest cmd ffff8a984150c600 from digest list

Recv thread calls pre release on iscsi_cmnd allocated for unsolicited
DataOut PDU:

[  977.563178] [3677]: req_cmnd_pre_release:820:req ffff8a984150d680

[  977.563181] [24654]: cmnd_put:775:cmnd ffff8a984150c600, new ref_cnt 1

SCST thread 24654 processing data digest on unsolicited DataOut PDU.
Here we have two threads accessing  the same iscsi_cmnd struct. SCST
thread will set on_rx_digest_list flag to 0. Recv thread will set
release_called flag to 1.

[  977.563184] [24654]: iscsi_pre_exec:1917:Checking digest of RX ddigest cmd ffff8a984150d680
[  977.563186] [24654]: cmd_del_from_rx_ddigest_list:830:Deleting RX digest cmd ffff8a984150d680 from digest list
[  977.563189] [24654]: cmnd_put:775:cmnd ffff8a984150d680, new ref_cnt 0

[  977.563191] [3677]: conn_get:868:conn ffff8a97d0df1600, new conn_ref_cnt 4
[  977.563194] [24654]: cmnd_done:589:cmnd ffff8a984150d680
[  977.563196] BUG at ./iscsi-scst/kernel/iscsi.c:598 (cmnd->on_rx_digest_list)
[  977.563212] ------------[ cut here ]------------
[  977.563215] kernel BUG at ./iscsi-scst/kernel/iscsi.c:598!

Reported and analyzed by Adam Hutchinson <ajhutchin@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7338 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-01-13 03:37:19 +00:00
Bart Van Assche
3ef4c364ab iscsi-scst/kernel/conn.c: Fix source code indentation
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7307 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-12-30 02:25:54 +00:00
Bart Van Assche
1d27948af3 iscsi-scst: Fix a format specifier
Detected by checkpatch.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7306 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-12-30 02:23:23 +00:00
Bart Van Assche
9246a05f7e Fix kernel-doc warnings
Avoid that building SCST with W=1 against kernel v4.15 triggers warnings about
kernel-doc header issues.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7298 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-12-29 22:34:17 +00:00
Bart Van Assche
8268f5d5b1 Convert setup_timer() into timer_setup() calls
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7294 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-12-28 18:44:21 +00:00
Bart Van Assche
892d25f4f2 iscsi-scst: Convert init_timer() into setup_timer() calls
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7292 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-12-28 18:42:58 +00:00
Bart Van Assche
7c550d4724 iscsi-scst: UEK 4.1.12-103.9.7.el7uek.x86_64 build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7272 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-12-19 16:35:40 +00:00
Bart Van Assche
6897c820f9 fcst/fcst.h: Add identifier names
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7266 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-11-13 16:49:39 +00:00
Bart Van Assche
4c05086b59 scst, iscsi-scst: Introduce scst_read(), scst_write(), scst_readv() and scst_writev()
This makes it easier to add support for new kernel versions, e.g. kernel
version v4.14.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7260 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-11-13 05:50:44 +00:00
Bart Van Assche
8d3f00f0ec isert-scst: Make an error message more informative
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7239 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-10-03 22:49:35 +00:00
Bart Van Assche
0518777b2d iscsi-scst: Suppress a recently introduced compiler warning
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7222 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-08-27 22:20:01 +00:00
Bart Van Assche
cc2b24478c iscsi-scst/kernel/event.c: Port to kernel v4.12
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7219 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-08-27 15:53:16 +00:00
Bart Van Assche
9e35afe1e0 Annotate fall-through in switch statements in a form recognized by gcc 7
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7216 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-08-27 15:28:57 +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
Vladislav Bolkhovitin
e5e4531049 iscsi-scst: cleanup
There's no need to end-align the padding. Plus, it's not optimal to
access front misaligned memory

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7195 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-25 02:11:06 +00:00
Bart Van Assche
81f80e1708 isert-scst: Fix a race condition that was introduced accidentally in r7184
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7186 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-16 02:04:47 +00:00
Bart Van Assche
830369e50d isert-scst: Avoid that shutdown sporadically hangs
Waiting for other threads to release an object using code like
"while (object->refcnt > 0) msleep(100)" without holding a reference
on 'object' is wrong because the memory object points at may be freed
before or while this loop is in progress. Hence introduce a global
portal object count and wait on that count instead of waiting for
the per-portal reference count to reach zero.

The use-after-free was introduced in r6952 ("isert: faster release
of isert_scst module").

See also https://sourceforge.net/p/scst/tickets/2/.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7184 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 18:53:01 +00:00
Bart Van Assche
cda5cadb1c isert-scst: Enable type checking for isert portal pointers
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7183 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 18:49:04 +00:00
Israel Rukshin
28c5d73550 isert-scst: fix isert connection teardown flow
Synchronizing the rdma_disconnect() with the post drain wr
as other ULPs like iSER do.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7181 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 13:45:02 +00:00
Bart Van Assche
b4118ea0f1 scst/include/backport.h: Add a kref_read() backport
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7178 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 03:06:54 +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
Bart Van Assche
909247cb3d scst: Port to Linux kernel v4.11
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7153 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-27 00:17:22 +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
a8b24ae319 iscsi_scst: conn_lookup() skips any conn already closing
This change helped a secondary problem I had under valgrind (due to some other
bug) with initiators timing out and reconnecting their sessions faster than the
threads were getting cleaned up (for one thing, valgrind only ever runs one
thread at a time).

It seems logical that the code in conn_lookup() would want to skip any
connection that's already known closing in this case, for the same reason it
searches the list in reverse.  And the dropping connections don't have to drop
in order, so searching in reverse doesn't seem sufficient to avoid finding a
wrong (stale, closing) connection structure.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7144 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-21 01:36:34 +00:00
Vladislav Bolkhovitin
296f133caf iscsi-scst: fix ENOMEM path
In an error path in iscsi_threads_pool_get(), when a new pool cannot be
allocated, if there is a pool on iscsi_thread_pools_list, it passes that back as
an alternative, so return zero in that case.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7143 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-21 01:32:07 +00:00
Vladislav Bolkhovitin
0e92843d30 iscsi-scst: reset conn->rx_task in scsi_cmnd_start() for EXTRACHECKS
In scsi_cmnd_start() conn->rx_task is intended to be set only during the
call to _stage1_done, but there was no code to reset it.  It doesn't
actually matter in execution, but it was a little confusing to wonder
and try to understand why it wasn't reset.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7142 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-21 01:17:53 +00:00
Vladislav Bolkhovitin
a8336afa4c iscsi-scst: change local names of ioctl() and open() to not conflict
Change local names of ioctl() and open() to not conflict with C library names.
This isn't really a bug in a strictly kernel-resident build, but the change
avoids symbol conflicts with libc when building for usermode.

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

with some changes



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7138 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-21 00:57:10 +00:00
Vladislav Bolkhovitin
eaa99a8770 Fix a few minor "extra" compiler warnings (mostly "const" issues)
Add "XXX" comments in a few places about potential problems seen in SCST code,
for future investigation and possible repair.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7123 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-14 01:03:25 +00:00
Vladislav Bolkhovitin
a2e0916fbf Fix a few compiler messages issued when some extra warnings are enabled:
casting const to non-const
    uninitialized structure members
    non-static local function
    missing enumerated switch-value cases

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7122 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:58:32 +00:00
Vladislav Bolkhovitin
baba3ad195 iscsi: avoid a crash in iscsi_extracheck_is_rd_thread()
Add an extra check in iscsi_extracheck_is_rd_thread() to avoid a crash when
conn->rd_task is NULL.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7111 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:12:46 +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
Bart Van Assche
e372a0123e scst: Coding style updates related to whitespace
This patch changes whitespace only and nothing else.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7102 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-02 00:09:14 +00:00