Support for the following block layer changes in the Linux Kernel v5.19:
- 44abff2c0b97 ("block: decouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD")
- 70200574cc22 ("block: remove QUEUE_FLAG_DISCARD")
The legacy API wrappers in include/linux/pci-dma-compat.h should go away as
they create unnecessary midlayering for include/linux/dma-mapping.h API.
Instead use dma-mapping.h API directly.
This patch fixes build for linux kernel v5.18.
The old zero-copy implementation that used zero_copy flag was removed in
commit 19c9aec2 ("vdisk_fileio: Remove the page cache based zero-copy
implementation"). Hence remove this flag since it is no longer used.
By default the qlini_mode module parameter set initiator mode to 'enabled'.
This forces a SCST user to perform additional steps to activate the target mode.
Thus, change the default qlini_mode to simplify target mode usage, since
the SCST qla2xxx_scst module is usually only used with it.
Calling scst_cmd_init_done() with SCST_CONTEXT_DIRECT from
sqa_qla2xxx_handle_cmd() cause a SCST READ commands to stall for
scst_user devices.
The problem is that scst_user devices use udev_cmd_threads for processing
SCST commands, so it's necessary to call the scst_user dev handler
callbacks from the SCST_CONTEXT_THREAD context.
For write commands, this is already done because scst_rx_data() always
processes commands with a THREAD context. But for READ commands, it
depends on passing the preferred context value to scst_cmd_init_done().
So pass the SCST_CONTEXT_THREAD or SCST_CONTEXT_TASKLET to
scst_cmd_init_done(). SCST_CONTEXT_TASKLET would also work, because
the context optimization in scst_init_cmd() will still set SCST_CONTEXT_THREAD
for READ commands.
Reported-by: Eitan Cohen <eitancohen456@gmail.com>
If there are any NPIV targets, sqa_exit() will call
scst_unregister_target() twice on them. The first is an explicit call,
the other is triggered by qlt_del_vtarget().
Calling scst_unregister_target() twice on the same target will cause
crash:
RIP: 0010:sqa_target_release+0x19/0x220 [qla2x00tgt]
Call Trace:
scst_unregister_target+0x8e/0x330 [scst]
sqa_qla2xxx_remove_target+0x63/0x70 [qla2x00tgt]
qlt_release+0x1e0/0x260 [qla2xxx_scst]
qlt_remove_target+0x46/0x1d0 [qla2xxx_scst]
qla24xx_vport_delete+0x92/0x1e0 [qla2xxx_scst]
fc_vport_terminate+0x45/0x170 [scsi_transport_fc]
qlt_del_vtarget+0x142/0x15d [qla2x00tgt]
fc_vport_terminate+0x45/0x170 [scsi_transport_fc]
qlt_del_vtarget+0x142/0x15d [qla2x00tgt]
sqa_exit+0xad/0xde4 [qla2x00tgt]
Therefore, call scst_unregister_target() only from qlt_del_vtarget()
NPIV port deregistering processing is different from physical port
processing. We use the same handling for both of them, which causes
the crash when it's an NPIV port. Hence separate the common processing
logic depending on the type of port.
Reported-by: Rob Turk <robtu@rtist.nl>
Aborting commands that have already been sent to the firmware can
cause BUG in qlt_free_cmd(): BUG_ON(cmd->sg_mapped)
For instance:
- Command passes rdx_to_xfer state, maps sgl, sends to the firmware
- Reset occurs, qla2xxx performs ISP error recovery, aborts the command
- Target stack calls qlt_abort_cmd() and then qlt_free_cmd()
- BUG_ON(cmd->sg_mapped) in qlt_free_cmd() occurs because sgl was not
unmapped
Thus, unmap sgl in qlt_abort_cmd() for commands with the aborted flag set.
Link: https://lore.kernel.org/r/AS8PR10MB4952D545F84B6B1DFD39EC1E9DEE9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[ commit 26f9ce53817a upstream ]
Google no longer support the use of third-party apps or devices which
ask you to sign in to your Google Account using only your username and
password. This causes problems when using github mail notification action
to send SCST patches. Hence, change the Google mail server to an another one.
There were 2 ways to create a set of sysfs files for a kobj_type,
through the default_attrs field, and the default_groups field.
The default_groups field was introduced in aa30f47cf666
("kobject: Add support for default attribute groups to kobj_type") # v5.2
The default_attrs field was dropped in cdb4f26a63c3
("kobject: kobj_type: remove default_attrs") # v5.18
Hence move the scst_sysfs sysfs code to use default_groups field
since Linux Kernel v5.2
There were 2 ways to create a set of sysfs files for a kobj_type,
through the default_attrs field, and the default_groups field.
The default_groups field was introduced in aa30f47cf666
("kobject: Add support for default attribute groups to kobj_type") # v5.2
The default_attrs field was dropped in cdb4f26a63c3
("kobject: kobj_type: remove default_attrs") # v5.18
Hence move the scst_mem sysfs code to use default_groups field
since Linux Kernel v5.2
For session recovery, driver relies on the dpc thread to initiate certain
operations. The dpc thread runs exclusively without the Mailbox interface
being occupied. A recent code change for heartbeat check via mailbox cmd 0
is preventing the dpc thread from carrying out its operation. This patch
allows the higher priority error recovery to run first before running the
lower priority heartbeat check.
Link: https://lore.kernel.org/r/20220310092604.22950-9-njavali@marvell.com
Fixes: d94d8158e184 ("scsi: qla2xxx: Add heartbeat check")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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 713b415726f1 upstream ]
User experienced device lost. The log shows Get port data base command was
queued up, failed, and requeued again. Every time it is requeued, it set
the FCF_ASYNC_ACTIVE. This prevents any recovery code from occurring
because driver thinks a recovery is in progress for this session. In
essence, this session is hung. The reason it gets into this place is the
session deletion got in front of this call due to link perturbation.
Break the requeue cycle and exit. The session deletion code will trigger a
session relogin.
Link: https://lore.kernel.org/r/20220310092604.22950-8-njavali@marvell.com
Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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 c02aada06d19 upstream ]
During purex packet handling the driver was incorrectly freeing a
pre-allocated structure. Fix this by skipping that entry.
System crashed with the following stack during a module unload test.
Call Trace:
sbitmap_init_node+0x7f/0x1e0
sbitmap_queue_init_node+0x24/0x150
blk_mq_init_bitmaps+0x3d/0xa0
blk_mq_init_tags+0x68/0x90
blk_mq_alloc_map_and_rqs+0x44/0x120
blk_mq_alloc_set_map_and_rqs+0x63/0x150
blk_mq_alloc_tag_set+0x11b/0x230
scsi_add_host_with_dma.cold+0x3f/0x245
qla2x00_probe_one+0xd5a/0x1b80 [qla2xxx]
Call Trace with slub_debug and debug kernel:
kasan_report_invalid_free+0x50/0x80
__kasan_slab_free+0x137/0x150
slab_free_freelist_hook+0xc6/0x190
kfree+0xe8/0x2e0
qla2x00_free_device+0x3bb/0x5d0 [qla2xxx]
qla2x00_remove_one+0x668/0xcf0 [qla2xxx]
Link: https://lore.kernel.org/r/20220310092604.22950-6-njavali@marvell.com
Fixes: 62e9dd177732 ("scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests")
Cc: stable@vger.kernel.org
Reported-by: Marco Patalano <mpatalan@redhat.com>
Tested-by: Marco Patalano <mpatalan@redhat.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 0972252450f9 upstream ]
User experienced some of the LUN failed to get rediscovered after long
cable pull test. The issue is triggered by a race condition between driver
setting session online state vs starting the LUN scan process at the same
time. Current code set the online state after notifying the session is
available. In this case, trigger to start the LUN scan process happened
before driver could set the session in online state. LUN scan ends up with
failure due to the session online check was failing.
Set the online state before reporting of the availability of the session.
Link: https://lore.kernel.org/r/20220310092604.22950-3-njavali@marvell.com
Fixes: aecf043443d3 ("scsi: qla2xxx: Fix Remote port registration")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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 6a45c8e137d4 upstream ]