Commit Graph

8815 Commits

Author SHA1 Message Date
Gleb Chesnokov
0ea9622afa scst_sysfs: Unify output format for scst_luns_mgmt_show()
All sysfs mgmt show functions print available parameters/attributes
without '.' at the end, except for scst_luns_mgmt_show(). So fix it.

This patch doesn't change any functionality.
2022-12-12 14:19:04 +03:00
Gleb Chesnokov
66016e5ee0 scst: Unbreak the RHEL 9.1 build
Fixes: https://github.com/SCST-project/scst/issues/101
2022-11-30 10:26:12 +03:00
Gleb Chesnokov
41380160f8 scst_copy_mgr: Serialize scst_cm_desig_list list updates
The SCST device may receive several events almost simultaneously to
update its designators. Each such event calls scst_cm_update_dev(),
which frees all device designators in the global list and then submits
a inquiry that fills a new designators into the scst_cm_desig_list list.

This is racy because submiting the inquiry is asynchronous and can be
finished in another thread.

	scst_cm_update_dev() 1       scst_cm_update_dev() 2
	----------------------       ----------------------

[1] mutex_lock(&scst_mutex)
[2] scst_cm_send_init_inquiry(dev, lun, NULL)
[3] mutex_unlock(&scst_mutex)
				[4] mutex_lock(&scst_mutex)
				[5] scst_cm_dev_free_designators(dev)
[6] scst_cm_init_inq_finish()
				[7] scst_cm_send_init_inquiry(dev, lun, NULL)
				[8] mutex_unlock(&scst_mutex)

As a result we may get the scst_cm_desig_list list, which contains
SCST device designators from several inquiries.

Hence serialize scst_cm_desig_list list updates.
2022-11-18 12:12:04 +03:00
Gleb Chesnokov
e3f9163efc scst_copy_mgr: Introduce scst_cm_dev_free_designators()
Introduce the helper function scst_cm_dev_free_designators(), which
purpose is to free copy manager designators for scst dev.

This patch doesn't change any functionality.
2022-11-18 12:12:04 +03:00
Gleb Chesnokov
1e10e4ff41 scst_copy_mgr: Fix scst_cm_desig_list list corruption
This patch should fix the following bug:

list_del corruption. next->prev should be ffff955cb1ea2540, but was ffff955c54a32440
 ------------[ cut here ]------------
kernel BUG at lib/list_debug.c:54!
invalid opcode: 0000 [#1] SMP PTI
Workqueue: events vdev_inq_changed_fn [scst_vdisk]
RIP: 0010:__list_del_entry_valid.cold+0x1d/0x47
Call Trace:
 scst_cm_dev_unregister+0x66/0xd0 [scst]
 scst_cm_update_dev+0x41/0xc0 [scst]
 process_one_work+0x1ee/0x390
 worker_thread+0x53/0x3e0
 kthread+0x124/0x150
 ret_from_fork+0x1f/0x30

scst_cm_desig_list is a global list for all SCST devices. It must be
protected with scst_cm_mutex because it can be modified by
scst_cm_init_inq_finish() from another thread when scst_cm_update_dev()
is called.

Fixes: https://github.com/SCST-project/scst/issues/99
2022-11-18 12:12:04 +03:00
Gleb Chesnokov
f93b3ae720 scst_copy_mgr: Introduce scst_cm_get_free_lun()
Introduce the helper function scst_cm_get_free_lun(), which purpose is
to return the next free copy manager LUN.

This patch doesn't change any functionality.
2022-11-18 12:12:04 +03:00
Gleb Chesnokov
049dc57b10 scst: Drop support for detect() method
Support for scst_tgt_template detect() method was declared obsolete
in 2015. Remove support for scst_tgt_template detect() method.

See also commit 4ac6d7a26d ("[PATCH] scst: Drop detect() method").
2022-11-10 11:46:03 +03:00
Gleb Chesnokov
2bffc71dfb scst_targ: Revert "scst: Fix __scst_init_cmd()"
This reverts commit 1a15ee560c.

Commit 398d41e753 ("scst: Revert "Increase tgt_dev_cmd_count by one"
(r8465)") reverted commit[1].

But there was no revert for commit[2], so add it.

 [1] Commit 5b0f9ef0b9 ("scst: Increase tgt_dev_cmd_count by one")
 [2] Commit 1a15ee560c ("scst: Fix __scst_init_cmd()")
2022-11-09 19:25:40 +03:00
Gleb Chesnokov
31318acbc8 scst_targ: Use 'atomic_inc_return' to check 'dev->dev_cmd_count'
1. atomic_inc_return() avoids a race in between atomic_read() &
   atomic_inc().
2. atomic_inc_return() is a few cycles faster than
   atomic_inc()/atomic_read() sequence.
2022-11-09 19:25:40 +03:00
Gleb Chesnokov
bbabdeeec1 qla2x00t-32gbit: Use transport-defined speed mask for supported_speeds
One of the sysfs values reported for supported_speeds was not valid (20Gb/s
reported instead of 64Gb/s).  Instead of driver internal speed mask
definition, use speed mask defined in transport_fc for reporting
host->supported_speeds.

Link: https://lore.kernel.org/r/20220927115946.17559-1-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 0b863257c17c upstream ]
2022-11-09 11:07:21 +03:00
Gleb Chesnokov
47202a1adf qla2x00t-32gbit: Fix serialization of DCBX TLV data request
Commit b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request") serialized
mailbox requests from userspace using the 'optrom' mutex. However, in the
case of DCBX TLV data, if the memory for it is already allocated, then the
mailbox request ends up not being serialized because it is done without
holding the 'optrom' mutex.

Link: https://lore.kernel.org/r/20220926230245.790508-1-rafaelmendsr@gmail.com
Fixes: b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request")
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 3ddeabd1536a upstream ]
2022-11-09 11:07:21 +03:00
Gleb Chesnokov
6172938313 qla2x00t-32gbit: Remove unused declarations for qla2xxx
qla2x00_get_fw_version_str() has been removed since commit abbd8870b9cb
("[SCSI] qla2xxx: Factor-out ISP specific functions to method-based call
tables.").

qla2x00_release_nvram_protection() has been removed since commit
459c537807bd ("[SCSI] qla2xxx: Add ISP24xx flash-manipulation routines.").

qla82xx_rdmem() and qla82xx_wrmem() have been removed since commit
3711333dfbee ("[SCSI] qla2xxx: Updates for ISP82xx.").

qla25xx_rd_req_reg(), qla24xx_rd_req_reg(), qla25xx_wrt_rsp_reg(),
qla24xx_wrt_rsp_reg(), qla25xx_wrt_req_reg() and qla24xx_wrt_req_reg() have
been removed since commit 08029990b25b ("[SCSI] qla2xxx: Refactor
request/response-queue register handling.").

qla2x00_async_login_done() has been removed since commit 726b85487067
("qla2xxx: Add framework for async fabric discovery").

qlt_24xx_process_response_error() has been removed since commit
c5419e2618b9 ("scsi: qla2xxx: Combine Active command arrays.").

Remove the declarations for them from header file.

Link: https://lore.kernel.org/r/20220913023722.547249-2-cuigaosheng1@huawei.com
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1b80addaae09 upstream ]
2022-11-09 11:07:21 +03:00
Gleb Chesnokov
2b1cb3a0bd qla2x00t-32gbit: Fix spelling mistake "definiton" -> "definition"
There is a spelling mistake in a MODULE_PARM_DESC description. Fix it.

Link: https://lore.kernel.org/r/20220906140010.194273-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit efca52749564 upstream ]
2022-11-09 11:07:21 +03:00
Gleb Chesnokov
7ff0ff7394 qla2x00t-32gbit: Update version to 10.02.07.900-k
Link: https://lore.kernel.org/r/20220826102559.17474-8-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit fed842d04dad upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
29c187d7e8 qla2x00t-32gbit: Define static symbols
drivers/scsi/qla2xxx/qla_os.c:40:20: warning: symbol 'qla_trc_array'
was not declared. Should it be static?
drivers/scsi/qla2xxx/qla_os.c:345:5: warning: symbol
'ql2xdelay_before_pci_error_handling' was not declared.
Should it be static?

Define qla_trc_array and ql2xdelay_before_pci_error_handling as static to
fix sparse warnings.

Link: https://lore.kernel.org/r/20220826102559.17474-7-njavali@marvell.com
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 2c57d0defa22 upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
c47794811b qla2x00t-32gbit: Backport to older kernel versions
Commit 7c15fc8f0d93 ("qla2x00t-32gbit: Enhance driver tracing with
separate tunable and more") introduced the use of the trace.h/trace_events.h
API.

Due to support for older kernel versions, limit the minimum kernel version to
use this enhance driver tracing to v5.5.

See also commit 288797871473 ("tracing: Adding new functions for kernel
access to Ftrace instances") # v5.5.
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
986f258c9c qla2x00t-32gbit: Enhance driver tracing with separate tunable and more
Older tracing of driver messages was to:

    - log only debug messages to kernel main trace buffer; and

    - log only if extended logging bits corresponding to this message is
      off

This has been modified and extended as follows:

    - Tracing is now controlled via ql2xextended_error_logging_ktrace
      module parameter. Bit usages same as ql2xextended_error_logging.

    - Tracing uses "qla2xxx" trace instance, unless instance creation have
      issues.

    - Tracing is enabled (compile time tunable).

    - All driver messages, include debug and log messages are now traced in
      kernel trace buffer.

Trace messages can be viewed by looking at the qla2xxx instance at:

    /sys/kernel/tracing/instances/qla2xxx/trace

Trace tunable that takes the same bit mask as ql2xextended_error_logging
is:

    ql2xextended_error_logging_ktrace (default=1)

Link: https://lore.kernel.org/r/20220826102559.17474-6-njavali@marvell.com
Suggested-by: Daniel Wagner <dwagner@suse.de>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 8bfc149ba24c upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
f16993126d qla2x00t-32gbit: Add NVMe parameters support in Auxiliary Image Status
Add new API to obtain the NVMe Parameters region status from the Auxiliary
Image Status bitmap.

Link: https://lore.kernel.org/r/20220826102559.17474-5-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Anil Gurumurthy <agurumurthy@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit d9ba85efc3fc upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
5368a06380 qla2x00t-32gbit: Add debugfs create/delete helpers
Define a few helpful macros for creating debugfs files.

Link: https://lore.kernel.org/r/20220826102559.17474-4-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 389f179b868e upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
8f9ee9ac13 qla2x00t-32gbit: Fix response queue handler reading stale packets
On some platforms, the current logic of relying on finding new packet
solely based on signature pattern can lead to driver reading stale
packets. Though this is a bug in those platforms, reduce such exposures by
limiting reading packets until the IN pointer.

Link: https://lore.kernel.org/r/20220826102559.17474-3-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit e4f8a29deb3b upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
aaccb98f03 qla2x00t-32gbit: Revert "qla2x00t-32gbit: Fix response queue handler reading stale packets"
Reverting this commit so that a fixed up patch, without adding new module
parameters, can be submitted.

    Link: https://lore.kernel.org/stable/166039743723771@kroah.com/

This reverts commit b1f707146923335849fb70237eec27d4d1ae7d62.

Link: https://lore.kernel.org/r/20220826102559.17474-2-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 6dc45a7322cb upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
c3c8eb9db8 qla2x00t-32gbit: Log message "skipping scsi_scan_host()" as informational
This message is helpful to troubleshoot missing LUNs/SAN boot errors.  It'd
be nice to log it by default instead of only being enabled with debug.

This user had an accidental/forgotten file modprobe.d/qla2xxx.conf w/
option qlini_mode=disabled from experiments with FC target mode, and their
boot LUN didn't come up, as it skips SCSI scan, of course.

However, their boot log didn't provide any clues to help understand that.

The issue/message could be figured out w/ ql2xextended_error_logging, but
it would have been simpler (or even deflected/addressed by user) if it had
been there by default. And it also would help support/triage/deflection
tooling.

Expected change:

 scsi host15: qla2xxx
+qla2xxx [0000:3b:00.0]-00fb:15: skipping scsi_scan_host() for non-initiator port
 qla2xxx [0000:3b:00.0]-00fb:15: QLogic QLE2692 - QLE2692 Dual Port 16Gb FC to PCIe Gen3 x8 Adapter.

According to:

  qla2x00_probe_one()
  ...
          ret = scsi_add_host(...);
  ...
                  ql_log(ql_log_info, ...
                          "skipping scsi_scan_host() for non-initiator port\n");
  ...
          ql_log(ql_log_info, ...
              "QLogic %s - %s.\n", ha->model_number, ha->model_desc);

Link: https://lore.kernel.org/r/20220825120159.275051-1-mfo@canonical.com
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit eee8bb4a2b58 upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
c014d35e7d qla2x00t-32gbit: Avoid flush_scheduled_work() usage
Although qla2xxx driver is calling schedule_{,delayed}_work() from 10
locations, I assume that flush_scheduled_work() from qlt_stop_phase1()
needs to flush only works scheduled by qlt_sched_sess_work(), for this loop
continues while "struct qla_tgt"->sess_works_list is not empty.

Link: https://lore.kernel.org/r/133c6723-90b6-5c8b-72b4-cc01eeb3a8c0@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 3cb0643a9aae upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
f890534904 qla2x00t-32gbit: Always wait for qlt_sess_work_fn() from qlt_stop_phase1()
Currently qlt_stop_phase1() may fail to call flush_scheduled_work(), for
list_empty() may return true as soon as qlt_sess_work_fn() called
list_del(). In order to close this race window, check list_empty() after
calling flush_scheduled_work().

If this patch causes problems, please check commit c4f135d64382
("workqueue: Wrap flush_workqueue() using a macro"). We are on the way to
remove all flush_scheduled_work() calls from the kernel.

Link: https://lore.kernel.org/r/7f24469d-9e39-3398-d851-329b54c0b923@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit a4345557527f upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
9ee0cd01e8 qla2x00t-32gbit: Remove unused qlt_tmr_work()
qlt_tmr_work() is no longer used since commit fb35265b12bb ("scsi:
qla2xxx: Remove session creation redundant code").

Link: https://lore.kernel.org/r/a0e53c70-b801-adf5-0549-b2b1e421a819@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1b2b8d45ccd6 upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
4e83e04b61 qla2x00t-32gbit: Remove unused del_sess_list field
"struct qla_tgt"->del_sess_list is no longer used since commit
726b85487067 ("qla2xxx: Add framework for async fabric discovery").

Link: https://lore.kernel.org/r/0c335e86-5624-b599-5137-f1377419fb0c@I-love.SAKURA.ne.jp
Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit e6852b41b560 upstream ]
2022-11-09 10:46:27 +03:00
Gleb Chesnokov
07e5959e61 scst_event: Use a private workqueue instead of the system workqueue
Any attempt to flush kernel-global WQs has possibility of deadlock
so we should simply stop using them, instead introduce scst_event_wq.

See also commit c4f135d64382 ("workqueue: Wrap flush_workqueue()
using a macro") # v5.19.
2022-11-04 13:26:20 +03:00
Gleb Chesnokov
f4686e9102 scst: Remove deprecated create_workqueue()
alloc_workqueue() replaces deprecated create_workqueue().
2022-11-04 13:26:20 +03:00
Gleb Chesnokov
bff6597767 scst_lib: Improve the use of scst_release_acg_wq
1. Add missing TRACE_ENTRY() to scst_lib_init().
2. Add error handling when scst_release_acg_wq creation fails.
3. Remove unneeded flush_workqueue().
2022-11-04 13:26:20 +03:00
Gleb Chesnokov
b3cc617154 scst/include/backport.h: Remove unused workqueues backport
All Linux kernel versions supported by SCST already implement
alloc_ordered_workqueue(), so remove its backport.
2022-11-04 13:26:20 +03:00
Gleb Chesnokov
3961019e74 ib_srpt: Port to Linux kernel v6.1
Support for the following IB changes in the Linux kernel v6.1:
- 91a3f14ec953 ("IB/cm: Remove the service_mask parameter from ib_cm_listen()")
2022-10-27 12:31:00 +03:00
Gleb Chesnokov
45f9f12bb3 iscsi-scst: Remove cm_listen conftest
Remove cm_listen conftest because iscsi-scst doesn't use ib_cm_listen API.
2022-10-27 12:31:00 +03:00
Gleb Chesnokov
79492d9233 qla2x00t-32gbit: Drop DID_TARGET_FAILURE use
DID_TARGET_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

 1. It's not propagated upwards, so SG IO/passthrough users will not see an
    error and think a command was successful.

 2. There is no handling for it in scsi_decide_disposition() so it
    results in entering SCSI error handling.

This has qla2xxx use DID_NO_CONNECT because it looks like we hit this error
when we can't find a port. It will give us the same hard error behavior and
it seems to match the error where we can't find the endpoint.

Link: https://lore.kernel.org/r/20220812010027.8251-7-michael.christie@oracle.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit a965d35c8741 upstream ]
2022-10-27 12:31:00 +03:00
Gleb Chesnokov
534bbd33b3 qla2x00t-32gbit: Port to Linux kernel v6.1
Support for the following block layer changes in the Linux kernel v6.1:
- a4e1d0b76e7b ("block: Change the return type of blk_mq_map_queues() into void")
2022-10-27 12:31:00 +03:00
Gleb Chesnokov
20ec24e076 scst_lib: Port to Linux kernel v6.1
Support for the following block layer changes in the Linux kernel v6.1:
- de671d6116b5 ("block: change request end_io handler to pass back a return value")
2022-10-27 12:31:00 +03:00
Gleb Chesnokov
9a7ec775ce scst_dlm: Port to Linux kernel v6.1
Support for the following vfs file changes in the Linux kernel v6.1:
- 25885a35a720 ("Change calling conventions for filldir_t")

Support for the following dlm changes in the Linux kernel v6.1:
- 12cda13cfd53 ("fs: dlm: remove DLM_LSFL_FS from uapi")
2022-10-27 12:31:00 +03:00
Gleb Chesnokov
1863f8c5c8 scripts: Remove references to the ibmvstgt, mpt and mvsas_tgt drivers 2022-10-25 10:44:54 +03:00
Gleb Chesnokov
d137b37fe1 scst_lib: Fix handling of a SENSE with buffer size 0
Sending a REQUEST_SENSE with a buffer size 0 to the LUN that does not
exist causes the following kernel panic:

RIP: 0010:sg_init_table+0x1e/0x30
Call Trace:
  scst_alloc_sg+0xc3/0x270 [scst]
  scst_set_cmd_error+0x803/0xa40 [scst]
  __scst_init_cmd+0x5c3/0xb80 [scst]
  scst_cmd_init_done+0x142/0xae0 [scst]
  cmnd_rx_start+0x7f5/0x13d0 [iscsi_scst]
  isert_pdu_rx+0x54/0x140 [isert_scst]
  isert_recv_completion_handler+0x498/0x580 [isert_scst]
  isert_poll_cq+0x396/0x800 [isert_scst]
  isert_cq_comp_work_cb+0x4a/0x120 [isert_scst]
  process_one_work+0x1d1/0x410
  worker_thread+0x2b/0x3d0
  kthread+0x11a/0x130
  ret_from_fork+0x1f/0x40

Hence set bufflen to 18 if a buffer size 0 was passed to avoid the
crash.

Reported-by: Lev Vainblat <lev@zadarastorage.com>
2022-10-23 18:31:38 +03:00
Gleb Chesnokov
54eeae329b scst_lib: Fix handling of an INQUIRY with buffer size 0
Sending an INQUIRY with a buffer size 0 to the LUN that does not exist
causes the following kernel panic:

RIP: 0010:sg_init_table+0x1e/0x30
Call Trace:
  scst_alloc_sg+0xc3/0x270 [scst]
  scst_set_cmd_error+0x8c9/0xa80 [scst]
  __scst_init_cmd+0x5c3/0xb80 [scst]
  scst_cmd_init_done+0x142/0xae0 [scst]
  cmnd_rx_start+0x7f5/0x13d0 [iscsi_scst]
  isert_pdu_rx+0x54/0x140 [isert_scst]
  isert_recv_completion_handler+0x498/0x580 [isert_scst]
  isert_poll_cq+0x396/0x800 [isert_scst]
  isert_cq_comp_work_cb+0x4a/0x120 [isert_scst]
  process_one_work+0x1d1/0x410
  worker_thread+0x2b/0x3d0
  kthread+0x11a/0x130
  ret_from_fork+0x1f/0x40

Hence set bufflen to 36 if a buffer size 0 was passed to avoid the
crash.

Reported-by: Lev Vainblat <lev@zadarastorage.com>
2022-10-23 18:31:38 +03:00
Gleb Chesnokov
9d83d8c28a scst_lib: Fix quoted string split across lines
This patch doesn't change any functionality.
2022-10-23 18:31:38 +03:00
Gleb Chesnokov
0c609d56a2 scst/include/backport.h: Remove support for RHEL5
The SCST has dropped support for RHEL5 since SCST v3.6.
2022-10-23 18:31:38 +03:00
Gleb Chesnokov
0c07b92b19 nightly build: Update kernel versions 2022-10-04 20:01:36 +03:00
Gleb Chesnokov
9f13194628 qla2x00t-32gbit: Fix memory leak in __qlt_24xx_handle_abts()
Commit 8f394da36a36 ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG")
made the __qlt_24xx_handle_abts() function return early if
tcm_qla2xxx_find_cmd_by_tag() didn't find a command, but it missed to clean
up the allocated memory for the management command.

Link: https://lore.kernel.org/r/20220914024924.695604-1-rafaelmendsr@gmail.com
Fixes: 8f394da36a36 ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG")
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 601be20fc6a1 upstream ]
2022-09-26 13:04:38 +03:00
Gleb Chesnokov
fa1a8e1ee5 scst/include/backport.h: Fix the build against CentOS 8-stream
Fixes: https://github.com/SCST-project/scst/issues/77
2022-09-15 12:17:52 +03:00
Gleb Chesnokov
102398a61f scripts/update-version: Update the SCST_VERSION_CODE
SCST_VERSION_CODE has not been updated since SCST v3.4 because
the update-version script used the wrong file for parsing. Hence fix
the update-version script and SCST_VERSION_CODE.
2022-09-14 12:36:33 +03:00
Gleb Chesnokov
5769ac8429 qla2x00t-32gbit: Disable ATIO interrupt coalesce for quad port ISP27XX
This partially reverts commit d2b292c3f6fd ("scsi: qla2xxx: Enable ATIO
interrupt handshake for ISP27XX")

For some workloads where the host sends a batch of commands and then
pauses, ATIO interrupt coalesce can cause some incoming ATIO entries to be
ignored for extended periods of time, resulting in slow performance,
timeouts, and aborted commands.

Disable interrupt coalesce and re-enable the dedicated ATIO MSI-X
interrupt.

Link: https://lore.kernel.org/r/97dcf365-89ff-014d-a3e5-1404c6af511c@cybernetics.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 53661ded2460 upstream ]
2022-09-13 11:47:01 +03:00
Gleb Chesnokov
807e2c31a6 qla2x00t-32gbit: Update version to 10.02.07.800-k
Link: https://lore.kernel.org/r/20220713052045.10683-11-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 6c20cc4885c5 upstream ]
2022-09-13 11:47:01 +03:00
Gleb Chesnokov
d3a4565a4a qla2x00t-32gbit: Update manufacturer details
Update manufacturer details to indicate Marvell Semiconductors.

Link: https://lore.kernel.org/r/20220713052045.10683-10-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bikash Hazarika <bhazarika@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 1ccad27716ec upstream ]
2022-09-13 11:47:01 +03:00
Gleb Chesnokov
0f7d7d7d70 qla2x00t-32gbit: Fix sparse warning for dport_data
Use le16_to_cpu to fix sparse warning reported for dport_data.

sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/qla2xxx/qla_bsg.c:2485:34: sparse: sparse: incorrect
>> type in assignment (different base types) @@ expected unsigned
>> short [usertype] mbx1 @@ got restricted __le16 @@
   drivers/scsi/qla2xxx/qla_bsg.c:2485:34: sparse: expected unsigned short [usertype] mbx1
      drivers/scsi/qla2xxx/qla_bsg.c:2485:34: sparse: got restricted __le16
>> drivers/scsi/qla2xxx/qla_bsg.c:2486:34: sparse: sparse:
>> incorrect type in assignment (different base types) @@
>> expected unsigned short [usertype] mbx2 @@ got restricted __le16 @@
   drivers/scsi/qla2xxx/qla_bsg.c:2486:34: sparse: expected unsigned short [usertype] mbx2
   drivers/scsi/qla2xxx/qla_bsg.c:2486:34: sparse: got restricted __le16

Link: https://lore.kernel.org/r/20220713052045.10683-9-njavali@marvell.com
Fixes: 476da8faa336 ("scsi: qla2xxx: Add a new v2 dport diagnostic feature")
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 166d74b876b7 upstream ]
2022-09-13 11:47:01 +03:00
Gleb Chesnokov
9faab8c7e2 qla2x00t-32gbit: Fix discovery issues in FC-AL topology
A direct attach tape device, when gets swapped with another, was not
discovered. Fix this by looking at loop map and reinitialize link if there
are devices present.

Link: https://lore.kernel.org/linux-scsi/baef87c3-5dad-3b47-44c1-6914bfc90108@cybernetics.com/
Link: https://lore.kernel.org/r/20220713052045.10683-8-njavali@marvell.com
Cc: stable@vger.kernel.org
Reported-by: Tony Battersby <tonyb@cybernetics.com>
Tested-by: Tony Battersby <tonyb@cybernetics.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 47ccb113cead upstream ]
2022-09-13 11:47:01 +03:00