Commit Graph

8851 Commits

Author SHA1 Message Date
Brian Meagher
87340a8427 scst_lib: Fix bio_kmalloc usage to match change in Linux kernel v5.19
In kernel commit 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc
wrapper"), the order of arguments to bio_kmalloc changed, as did its semantics.
2023-01-28 14:52:48 +03:00
Brian Meagher
d401702aba scst_lib: Fix sense data regression for pass-through commands.
In kernel commit 772c8f6f3bbd ("Merge tag 'for-4.11/linus-merge-signed' * of
git://git.kernel.dk/linux-block") both scsi_init_rq and scsi_init_request
(later renamed to scsi_mq_init_request in e7008ff5c61a) initialize the
scsi_request sense buffer, so we don't need to (nor should) provide our own.
2023-01-27 11:48:05 +03:00
Gleb Chesnokov
ae6c0bf914 scst_disk: Fix use of uninitialized variable
This patch fixes the following Coverity complaint:

    CID 307352 (#1 of 1): Uninitialized pointer read (UNINIT)
    uninit_use_in_call: Using uninitialized value arg when calling
    kfree.

Fixes: 7ba5b11f0a ("scst_disk: Add cluster SCSI sync state mode
support to dev_disk")
2023-01-20 10:48:47 +03:00
Brian Meagher
7ba5b11f0a scst_disk: Add cluster SCSI sync state mode support to dev_disk
Extend the cluster mode support that was first introduced in 9d61dc4b to
include dev_disk.  This will facilitate the situation where the underlying
disk is another SCST target.

Add the cluster_mode control to the sysfs subtree for the dev_disk to permit
entering or exiting cluster mode.

In disk_attach issue a INQUIRY (Unit Serial Number VPD) to obtain the serial
number of the underlying disk.  This is used when entering or exiting
cluster mode as the cl_dev_id parameter, which ultimately is used as part of
the DLM lockspace.
2023-01-20 10:12:58 +03:00
Samy Mahmoudi
fbe5316fc7 scst/README: Correct description of 'opt_trans_len'
1. Correct a sentence where 'optimal transfer length' should read 'block size'.
2. Use '4194304' instead of '4 MB' when referring to a value of the parameter.
2023-01-20 10:09:26 +03:00
Gleb Chesnokov
8e8670d43b qla2x00t-32gbit: Use better sense data for transport error
After a transport error, return "aborted command" sense data rather than
"medium error / write error" (which is more appropriate for a problem
writing to the disk / tape / physical medium).

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2023-01-13 17:06:32 +03:00
Gleb Chesnokov
0bfb746e52 qla2x00t-32gbit: Fix LUN parsing for ABORT_TASK_SET
When processing ABORT_TASK_SET, qla2xxx_scst passes the wrong LUN to
SCST, resulting in errors like:

sqatgt(7/0): Received task management cmd: lun=29, type=2, tag=0
sqatgt(7/0) ABORT_TS received.
[161]: scst: TM fn ABORT_TASK_SET/1 (mcmd 00000000d42b66dd, initiator c0:50:76:0b:e9:52:00:a2, target 21:00:00:24:ff:82:96:a5)
[10400]: scst: ***ERROR***: Corresponding device for LUN 7424 not found

(where 29 is the correct LUN and 7424 is bogus)

Fix by making LUN parsing for ABORT_TASK_SET the same as all the other
TMR cases.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
2023-01-13 17:06:32 +03:00
Gleb Chesnokov
3ba2549ac4 github: Update actions/checkout to v3
This patch should fix the following github warning:

    Node.js 12 actions are deprecated. Please update the following
    actions to use Node.js 16: actions/checkout@v2
2023-01-13 16:52:07 +03:00
Gleb Chesnokov
a7665a4535 Makefile: Delete the source code archive after building the scst-dkms-rpm packages 2023-01-10 13:52:51 +03:00
Gleb Chesnokov
7b0a2f8e69 Makefile, scstadmin/Makefile: Use git sha1 as the SCST revision
git sha1 is a more convenient way to generate a revision than the number
of commits. Also, remove svn repository support.
2023-01-10 13:52:51 +03:00
Gleb Chesnokov
3d1dd5c90a Makefile, scst[-dkms].spec.in: Add support for PKG_BUILD_MODE
See also commit 95c9bdc0f7 ("pass through `DEBUG_MODE_LEVEL` to
`dpkg` make target").
2023-01-10 13:52:51 +03:00
Gleb Chesnokov
baa8a58833 Makefile, debian: Rename the DEBUG_MODE_LEVEL variable into PKG_BUILD_MODE
The latter name reflects better the role of this variable.
2023-01-10 13:52:51 +03:00
S.Katyshev
95c9bdc0f7 pass through DEBUG_MODE_LEVEL to dpkg make target
It's quite strange but we can't run `make dpkg` with other
debug mode level.
2023-01-09 13:05:45 +03:00
Gleb Chesnokov
23252a4e42 qla2x00t-32gbit: Fix crash when I/O abort times out
While performing CPU hotplug, a crash with the following stack was seen:

Call Trace:
     qla24xx_process_response_queue+0x42a/0x970 [qla2xxx]
     qla2x00_start_nvme_mq+0x3a2/0x4b0 [qla2xxx]
     qla_nvme_post_cmd+0x166/0x240 [qla2xxx]
     nvme_fc_start_fcp_op.part.0+0x119/0x2e0 [nvme_fc]
     blk_mq_dispatch_rq_list+0x17b/0x610
     __blk_mq_sched_dispatch_requests+0xb0/0x140
     blk_mq_sched_dispatch_requests+0x30/0x60
     __blk_mq_run_hw_queue+0x35/0x90
     __blk_mq_delay_run_hw_queue+0x161/0x180
     blk_execute_rq+0xbe/0x160
     __nvme_submit_sync_cmd+0x16f/0x220 [nvme_core]
     nvmf_connect_admin_queue+0x11a/0x170 [nvme_fabrics]
     nvme_fc_create_association.cold+0x50/0x3dc [nvme_fc]
     nvme_fc_connect_ctrl_work+0x19/0x30 [nvme_fc]
     process_one_work+0x1e8/0x3c0

On abort timeout, completion was called without checking if the I/O was
already completed.

Verify that I/O and abort request are indeed outstanding before attempting
completion.

Fixes: 71c80b75ce8f ("scsi: qla2xxx: Do command completion on abort timeout")
Reported-by: Marco Patalano <mpatalan@redhat.com>
Tested-by: Marco Patalano <mpatalan@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20221129092634.15347-1-njavali@marvell.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 68ad83188d78 upstream ]
2023-01-09 12:50:34 +03:00
Gleb Chesnokov
590ad2f0b9 scst_lib, scst_vdisk: Port to Linux kernel v6.2
bio_set_op_attrs has been removed, replace it with a direct
assignment of the flags to bio->bi_opf.

See also commit c34b7ac65087 ("block: remove bio_set_op_attrs") # v6.2.
2023-01-09 12:48:57 +03:00
Brian Meagher
cbc8d5ee9b scst/include/backport.h: Do not set rq->end_io to NULL
Fix a regression introduced during d989aa91f3 ("scst_lib: Port to
Linux kernel v5.19") that breaks dev_disk operation.

The kernel function blk_execute_rq_nowait will set rq->end_io to the
done parameter, so pass in the existing rq->end_io rather than NULL
to prevent zeroing it.

Fixes: d989aa91f3 ("scst_lib: Port to Linux kernel v5.19")
[ glebchesn: added patch description ]
2023-01-05 20:37:27 +03:00
Gleb Chesnokov
01c489c05f github: Update the version of SCST for the Coverity action 2022-12-28 17:08:44 +03:00
Gleb Chesnokov
e48a3003f9 github: Update stable branch version for the Mailing list action 2022-12-28 17:08:44 +03:00
Gleb Chesnokov
b78582f34d Bump the version number to 3.8.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 8 0 -pre
2022-12-28 17:08:44 +03:00
Gleb Chesnokov
24e8b1d388 nightly build: Update kernel versions v3.7 2022-12-27 16:47:20 +03:00
Gleb Chesnokov
40de8ce2b7 www: Update the links of the top level items "Main" and "News"
We moved to GitHub a year ago, so replace the SourceForge URLs with
the actual GitHub URLs.
2022-12-27 16:47:20 +03:00
Gleb Chesnokov
b91a5d5d54 www: Update the version number from 3.6 to 3.7
Additionally, change the link to the github tags page into a link to the
github releases page.
2022-12-27 16:47:20 +03:00
Gleb Chesnokov
1ef10b852d Bump the version number to 3.7.0
These changes have been generated by running the following command:

$ scripts/update-version 3 7 0
2022-12-27 16:47:20 +03:00
Gleb Chesnokov
247c26d2c8 scst/ChangeLog: Summarize the changes for the upcoming 3.7 release 2022-12-27 16:47:20 +03:00
Gleb Chesnokov
7dc56a07bf scst: Backport the PTR_ERR_OR_ZERO() function
Unbreak the build for the previous commit against kernel versions
before v3.12.

Fixes: ee6312ac5a ("scst_vdisk, qla2x00t-32gbit: Use PTR_ERR_OR_ZERO
instead of IS_ERR and PTR_ERR")
2022-12-27 16:23:46 +03:00
Gleb Chesnokov
ee6312ac5a scst_vdisk, qla2x00t-32gbit: Use PTR_ERR_OR_ZERO instead of IS_ERR and PTR_ERR
This patch doesn't change any functionality.
2022-12-21 15:04:05 +03:00
Gleb Chesnokov
64fb79629b scst_targ: Fix error handling in scst_mgmt_cmd_exec()
scst_clear_aca_mcmd() can only return an error if
scst_set_mcmd_next_state() fails. In this case, the mcmd->state will be
SCST_MCMD_STATE_WAITING_AFFECTED_CMDS_DONE or
SCST_MCMD_STATE_WAITING_AFFECTED_CMDS_FINISH. Thus, a secondary call of
scst_set_mcmd_next_state() will match the default branch of the switch
statement, resulting in a crash.

Therefore, fix the error handling for scst_clear_aca_mcmd() to avoid
this case.

This patch fixes the following Coverity complaint:

    CID 271592 (#1 of 1): Unused value (UNUSED_VALUE)
    returned_value: Assigning value from scst_clear_aca_mcmd(mcmd) to
    res here, but that stored value is overwritten before it can be
    used.
2022-12-19 12:10:04 +03:00
Gleb Chesnokov
5dbe691552 qla2x00t: Fix use of uninitialized struct field
This patch fixes the following Coverity complaint:

    CID 271580 (#2 of 2): Uninitialized scalar variable (UNINIT)
    uninit_use_in_call: Using uninitialized value mcp->tov when calling
    ql_dbg.
2022-12-19 12:10:04 +03:00
Gleb Chesnokov
e8b300ef2a usr/fileio/common.c: Fix use of uninitialized struct field
This patch fixes the following Coverity complaint:

    CID 275308 (#1-2 of 2): Uninitialized scalar variable (UNINIT)
    uninit_use_in_call: Using uninitialized value
    multi.multi_cmd.replies_done when calling fprintf.
2022-12-19 12:10:04 +03:00
Gleb Chesnokov
8cd13de7f8 qla2x00t-32gbit: Initialize vha->unknown_atio_[list, work] for NPIV hosts
Initialization of vha->unknown_atio_list and vha->unknown_atio_work only
happens for base_vha in qlt_probe_one_stage1(). But there is no
initialization for NPIV hosts that are created in qla24xx_vport_create().

This causes a crash when trying to access these NPIV host fields.

Fix this by adding initialization to qla_vport_create().

Signed-off-by: Gleb Chesnokov <gleb.chesnokov@scst.dev>
Link: https://lore.kernel.org/r/376c89a2-a9ac-bcf9-bf0f-dfe89a02fd4b@scst.dev
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 95da5e58172c upstream ]

Fixes: https://github.com/SCST-project/scst/issues/56
2022-12-15 16:51:38 +03:00
Gleb Chesnokov
753ea9e778 qla2x00t-32gbit: Remove duplicate of vha->iocb_work initialization
Commit 9b3e0f4d4147 ("scsi: qla2xxx: Move work element processing out of
DPC thread") introduced the initialization of vha->iocb_work in
qla2x00_create_host() function.

This initialization is also called from qla2x00_probe_one() function, just
after qla2x00_create_host().

Hence remove this duplicate call since it has already been called before.

Signed-off-by: Gleb Chesnokov <gleb.chesnokov@scst.dev>
Link: https://lore.kernel.org/r/822b3823-f344-67d6-30f1-16e31cf68eed@scst.dev
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 3620e174d260 upstream ]
2022-12-15 16:51:38 +03:00
Gleb Chesnokov
ba8a969f80 qla2x00t-32gbit: Remove unused variable 'found_devs'
Variable 'found_devs' is just being incremented and it's never used
anywhere else. Remove it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20221101104733.30363-1-colin.i.king@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit e137b81d30e7 upstream ]
2022-12-15 16:51:38 +03:00
Gleb Chesnokov
3c7cb265ee qla2x00t-32gbit: Fix set-but-not-used variable warnings
Fix the following two compiler warnings:

drivers/scsi/qla2xxx/qla_init.c: In function ‘qla24xx_async_abort_cmd’:
drivers/scsi/qla2xxx/qla_init.c:171:17: warning: variable ‘bail’ set but not used [-Wunused-but-set-variable]
  171 |         uint8_t bail;
      |                 ^~~~
drivers/scsi/qla2xxx/qla_init.c: In function ‘qla2x00_async_tm_cmd’:
drivers/scsi/qla2xxx/qla_init.c:2023:17: warning: variable ‘bail’ set but not used [-Wunused-but-set-variable]
 2023 |         uint8_t bail;
      |                 ^~~~

Cc: Arun Easi <arun.easi@qlogic.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Fixes: feafb7b1714c ("[SCSI] qla2xxx: Fix vport delete issues")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20221031224818.2607882-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 4fb2169d66b8 upstream ]
2022-12-15 16:51:38 +03:00
Gleb Chesnokov
31699069f3 nightly build: Include the AlmaLinux RHEL kernels
Add support for RHEL 8.6 8.7 9.0 9.1 nightly builds.
2022-12-14 10:25:38 +03:00
Gleb Chesnokov
80471ef507 scripts/kernel-functions: Improve gcc 12 support
Fix nightly build with gcc 12 for kernel versions 5.11, 5.12, 5.13,
5.14.
2022-12-14 10:25:38 +03:00
Gleb Chesnokov
cbf2f25494 nightly build: Update kernel versions 2022-12-12 20:13:06 +03:00
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