summaryrefslogtreecommitdiff
path: root/drivers/scsi/fnic
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2020-01-16 13:20:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-06 00:22:49 +0300
commitedb6590b1b2c5f2cdccf4cc10bc86c254ca542e4 (patch)
treec27931bf155658ad3dfcd49d01dc4c26bcc632ec /drivers/scsi/fnic
parent3075e636b368c4a1ca018fa16cda57885edd4c86 (diff)
downloadlinux-edb6590b1b2c5f2cdccf4cc10bc86c254ca542e4.tar.xz
scsi: fnic: do not queue commands during fwreset
[ Upstream commit 0e2209629fec427ba75a6351486153a9feddd36b ] When a link is going down the driver will be calling fnic_cleanup_io(), which will traverse all commands and calling 'done' for each found command. While the traversal is handled under the host_lock, calling 'done' happens after the host_lock is being dropped. As fnic_queuecommand_lck() is being called with the host_lock held, it might well be that it will pick the command being selected for abortion from the above routine and enqueue it for sending, but then 'done' is being called on that very command from the above routine. Which of course confuses the hell out of the scsi midlayer. So fix this by not queueing commands when fnic_cleanup_io is active. Link: https://lore.kernel.org/r/20200116102053.62755-1-hare@suse.de Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/scsi/fnic')
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 80608b53897b..e3f5c91d5e4f 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -439,6 +439,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
return SCSI_MLQUEUE_HOST_BUSY;
+ if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_FWRESET)))
+ return SCSI_MLQUEUE_HOST_BUSY;
+
rport = starget_to_rport(scsi_target(sc->device));
if (!rport) {
FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,