* [PATCH] fnic: do not queue commands during fwreset
@ 2020-01-16 10:20 Hannes Reinecke
2020-01-21 4:58 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2020-01-16 10:20 UTC (permalink / raw)
To: Satish Kharat
Cc: Sesidhar Baddela, Karan Tilak Kumar, Martin K. Petersen,
Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke
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.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/fnic/fnic_scsi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 8ef150dfb6f7..b60795893994 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,
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fnic: do not queue commands during fwreset
2020-01-16 10:20 [PATCH] fnic: do not queue commands during fwreset Hannes Reinecke
@ 2020-01-21 4:58 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2020-01-21 4:58 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
Martin K. Petersen, Christoph Hellwig, James Bottomley,
linux-scsi
Hannes,
> 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.
Applied to 5.5/scsi-fixes, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-21 4:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 10:20 [PATCH] fnic: do not queue commands during fwreset Hannes Reinecke
2020-01-21 4:58 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).