Remove the else because the if statement has a break or return statement.
This patch fixes the following checkpatch warnings:
WARNING:UNNECESSARY_ELSE: else is not generally useful after a break
or return.
This patch should fix the following bug:
iscsi-scst: ***ERROR***: Sending data failed: initiator ..., write_size 0, write_state 1, res 0
iscsi-scst: ***CRITICAL ERROR***: 0 6 31
------------[ cut here ]------------
kernel BUG at /usr/src/packages/BUILD/scst-3.7.0.8695/iscsi-scst/kernel/nthread.c:1517!
invalid opcode: 0000 [#1] SMP NOPTI
CPU: 12 PID: 997595 Comm: iscsiwr0_14 ...
...
RIP: 0010:iscsi_send+0x877/0x8b0 [iscsi_scst]
Call Trace:
istwr+0x123/0x3b0 [iscsi_scst]
kthread+0x120/0x136
ret_from_fork+0x24/0x36
-------------------------------------
What happens:
- istwr() calls scst_do_job_wr().
- scst_do_job_wr() calls iscsi_send().
- iscsi_send() sets the 'res' variable to 0 during error
in one of three possible places:
iscsi_do_send(), tx_padding(), tx_ddigest().
- All of these functions call exit_tx() which sets conn->write_state to TX_END.
- After iscsi_send() has completed for the current iteration, the next time
it processes iscsi_conn with conn->write_state == TX_END,
which will call BUG() in the switch default case.
Therefore, remove the res == 0 check in iscsi_send() to handle TX_END state.
Fixes: https://github.com/SCST-project/scst/issues/12
Suppress the following (false positive) Coverity complaint:
CID 271578 (#1 of 1): Dereference after null check (FORWARD_NULL)
var_deref_model: Passing null pointer (*ref_cmd).scst_cmd to
scst_set_delivery_status, which dereferences it
(*ref_cmd).scst_aen is set when (*ref_cmd).scst_state == ISCSI_CMD_STATE_AEN
and vice versa, so the Coverity complaint is a false positive. Hence rewrite
the code to suppress this complaint and make the code cleaner.
This patch does not change any functionality but removes multiple __force
__user casts.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9197 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
This patch is necessary to make SCST work with Linux kernel v5.1 and
does not change any functionality. See also upstream commit 736706bee329
("get rid of legacy 'get_ds()' function").
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8057 d57e44dd-8a1f-0410-8b47-8ef2f437770f
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
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
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
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
The C language does not require to use an explicit cast when assigning
a void * pointer to a pointer of another type.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6633 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The second TM request can come while the old one, response for which is
going to be delayed, is still being processed, hence no response
prepared yet, so the delayed response should be dropped on the stage of
the new response preparing. Otherwise in this place the old delayed
response will trigger BUG_ON().
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6456 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that checkpatch reports the following warning:
WARNING: type 'long long unsigned' should be specified in 'unsigned long long' order.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Since scst.h contains a backport of the definition of set_cpus_allowed_ptr(),
the set_cpus_allowed() invocations are superfluous. Hence remove these.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5734 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Start at the proper offset in the receive buffer if sg[0].offset != 0.
Return the proper data to the initiator if sg[0].offset != 0.
This patch reworks trunk r5281, "iscsi-scst: fix offset
calculation", February 13, 2014.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5683 d57e44dd-8a1f-0410-8b47-8ef2f437770f
With CONFIG_BUG=y both BUG() and BUG_ON(1) halt the system. However,
with CONFIG_BUG=n BUG() halts the system but BUG_ON(1) not. To avoid
such subtleties, change BUG_ON(1) into BUG().
See also patch Josh Triplett, "bug: Make BUG() always stop the machine",
7 April 2014 (commit ID a4b5d580e07875f9be29f62a57c67fbbdbb40ba2).
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5618 d57e44dd-8a1f-0410-8b47-8ef2f437770f