Skip to content

Commit 0e22096

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: fnic: do not queue commands during fwreset
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/[email protected] Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 28d76df commit 0e22096

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
439439
if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
440440
return SCSI_MLQUEUE_HOST_BUSY;
441441

442+
if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_FWRESET)))
443+
return SCSI_MLQUEUE_HOST_BUSY;
444+
442445
rport = starget_to_rport(scsi_target(sc->device));
443446
if (!rport) {
444447
FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,

0 commit comments

Comments
 (0)