fnic: do not queue commands during fwreset
Subsystems (2)
PATCH 1/1 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.
--- drivers/scsi/fnic/fnic_scsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/fnic/fnic_scsi.c +3 -0
@@ -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,
Signature · 1 line
2.16.4
Martin K. Petersen
AppliedHannes,
Quoted 5 lines
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 thehost_lock, calling 'done' happens after thehost_lockis being dropped.
Applied to 5.5/scsi-fixes, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering