After initiator has burned up all login retries, target authentication
application begins to run. This triggers a link bounce on target side.
Initiator will attempt another login. Due to N2N, the PRLI [nvme | fcp] can
fail because of the mode mismatch with target. This patch add a few more
login retries to revive the connection.
Link: https://lore.kernel.org/r/20220607044627.19563-11-njavali@marvell.com
Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit aec55325ddec upstream ]
User failed to see disk via n2n topology. Driver used up all login retries
before authentication application started. When authentication application
started, driver did not have enough login retries to connect securely. On
app_start, driver will reset the login retry attempt count.
Link: https://lore.kernel.org/r/20220607044627.19563-10-njavali@marvell.com
Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 789d54a41786 upstream ]
Recently driver has implemented a new doorbell mechanism via bsg. The new
doorbell tells driver the exact buffer size application has where driver
can fill it up with events. The old doorbell guestimated application buffer
size is 256.
Remove duplicate functionality, the application has moved on to the new
doorbell interface.
Link: https://lore.kernel.org/r/20220607044627.19563-9-njavali@marvell.com
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1040e5f75ddf upstream ]
When a thread is in the process of reestablish a session, a flag is set to
prevent multiple threads/triggers from doing the same task. This flag was
left on, and any attempt to relogin was locked out. Clear this flag if the
attempt has failed.
Link: https://lore.kernel.org/r/20220607044627.19563-6-njavali@marvell.com
Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit e0fb8ce2bb9e upstream ]
The commit ec325c9913bd ("qla2x00t-32gbit: edif: Add bsg interface to
read doorbell events") introduced the use of the sg_copy_buffer()
function.
The kernel has only exported this function since version v4.2, so use
sg_pcopy_from_buffer() instead, which is already supported by older
kernel versions.
Add bsg interface for app to read doorbell events. This interface lets
driver know how much app can read based on return buffer size. When the
next event(s) occur, driver will return the bsg_job with the event(s) in
the return buffer.
If there is no event to read, driver will hold on to the bsg_job up to few
seconds as a way to control the polling interval.
Link: https://lore.kernel.org/r/20220607044627.19563-5-njavali@marvell.com
Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 5ecd241bd7b1 upstream ]
On session deletion, wait for app to acknowledge before moving on. This
allows both app and driver to stay in sync. In addition, this gives a
chance for authentication app to do any type of cleanup before moving on.
Link: https://lore.kernel.org/r/20220607044627.19563-4-njavali@marvell.com
Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit df648afa39da upstream ]
This patch uses GFFID switch command to scan whether remote device is
Target or Initiator mode. Based on that info, driver will not pass up
Initiator info to authentication application. This helps reduce unnecessary
stress for authentication application to deal with unused connections.
Link: https://lore.kernel.org/r/20220607044627.19563-2-njavali@marvell.com
Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs")
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 9c40c36e75ff upstream ]
sgv_pool_destroy() does not tolerate a NULL sgv_pool pointer argument and
performs a NULL-pointer dereference. This requires additional attention
and effort from developers/reviewers and forces all sgv_pool_destroy()
callers to do a NULL check
if (pool)
sgv_pool_destroy(pool);
Or, otherwise, be invalid sgv_pool_destroy() users.
Tweak sgv_pool_destroy() and NULL-check the pointer there.
The register_shrinker() function has begun to return non void value since
v3.12 version. So fix the backport of this function for kernel versions
before v3.12.
Fixes: 84bd33f9a1 ("scst_mem: Port to Linux kernel v6.0")
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.
kmem_cache_destroy() can handle NULL pointer correctly, so there is no need
to check NULL pointer before calling kmem_cache_destroy().
For kernel versions before v4.3 there is a backport of
kmem_cache_destroy() that checks for a null pointer.
This patch fixes the following checkpatch warnings:
WARNING:NEEDLESS_IF: kmem_cache_destroy(NULL) is safe and this check
is probably not required
The bare "unsigned" type implicitly means "unsigned int", but the preferred
coding style is to use the complete type name.
This patch fixes the following checkpatch warnings:
WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'
Change 'compability' to 'compatibility'.
This patch fixes the following checkpatch warning:
WARNING: 'compability' may be misspelled - perhaps 'compatibility'?
Support for the ib_srpt_target_<n> target port names was removed in 2015.
Update the documentation that still uses this target port name format.
Remove all references to the obsolete ib_srpt kernel module parameters
use_port_guid_in_session_name and use_node_guid_in_target_name. Remove
the references from srpt/README to target port name formats that are no
longer supported.
This patch fixes the following Coverity complaint:
CID 275306 (#1 of 1): Resource leak (RESOURCE_LEAK)
Variable cwrp going out of scope leaks the storage it points to.
In the scst_cmp_wr_local() function, we don't free 'cwrp' if the next
check after the memory allocation fails. Hence move this check before
allocating memory.
Fixes: 4525b04b2 ("scst: Reject inconsistent COMPARE AND WRITE commands")
The GitHub virtual environment provides Ubuntu with a kernel that doesn't
support FCoE, causing the build to fail:
ERROR: modpost: "fc_seq_release" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_fc4_register_provider" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_lport_iterate" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_seq_els_rsp_send" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_seq_assign" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "_fc_frame_alloc" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_fill_reply_hdr" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_exch_done" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_fc4_deregister_provider" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
ERROR: modpost: "fc_frame_alloc_fill" [/root/gleb/SCST/scst/fcst/fcst.ko] undefined!
WARNING: modpost: suppressed 4 unresolved symbol warnings because there were too many)
Ignore these errors and continue building SCST to get all the information
for analysis.
We should clear sysfs during copy manager device registration failure.
Otherwise, we will not be able to re-register this device, since the
sysfs for it has already been created.
1. scst_cm_send_init_inquiry() gets a reference on struct scst_device, but
doesn't put it in case of an error, so this may cause a reference leak.
2. scst_cm_init_inq_finish() shouldn't put a reference on struct
scst_device during the retry, since we have to hold the reference as
long as there is a pointer to struct scst_device in the priv field.
Otherwise, the retry command will run without holding the reference.
Fixes: ec3c6b5a ("scst_copy_mgr, initial inquiry: Hold a reference on
struct scst_device")
Most targets of this Makefile require a underlying Makefile to be
created before they are called. Otherwise you will get an error like
this:
make -C scst-1.0.0 clean
make[3]: Entering directory '/.../scst/scstadmin/scstadmin.sysfs/scst-1.0.0'
make[3]: *** No rule to make target 'clean'. Stop.
Hence add a target that creates a underlying Makefile and add it as a
dependency for all required targets.
Currently we have several places where activating/deactivating of
virtual device happens:
1. sysfs 'active' attribute
2. on_alua_state_change_*() callback functions
They all use the same code to activate/deactivate virtual device.
Hence introduce the new vdisk_activate_dev() and vdisk_disable_dev()
helpers in order to reduce code duplication.
This patch doesn't change any functionality.
The use of the on_alua_state_change_*() callback functions was changed in
commit d333ce82 ("Restore the on_alua_state_change_*() callback functions")
in a such way that they are now only invoked if the state of a local target
port group is being modified.
But when compared to the old implementation, which was removed in commit
29548a4a ("scst: Remove the on_alua_state_change_*() callback functions"),
they won't be invoked for devices that do not have target devices, or have
only those that aren't included in the target group.
Hence additionally invoke these callbacks for such devices if the state of
a local target port group is being modified.
Fixes: https://github.com/SCST-project/scst/issues/55
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 fixes the following Coverity complaint:
CID 271601 (#1 of 1): Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value req.
Field req.cid is uninitialized when calling iscsid_request.
This patch fixes the following Coverity complaint:
CID 271606 (#1 of 1): Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value event.
Field event.target_name is uninitialized when calling __event_send.