diff options
| author | Bart Van Assche <[email protected]> | 2023-11-15 19:33:43 +0000 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2023-11-25 00:23:44 +0000 |
| commit | 10b53db2db8dfda84b25833043f2b63123572af6 (patch) | |
| tree | fa620f73a3687e516fe57536d5195619100b3f17 /drivers/scsi/scsi_error.c | |
| parent | scsi: bfa: Use the proper data type for BLIST flags (diff) | |
| download | kernel-10b53db2db8dfda84b25833043f2b63123572af6.tar.gz kernel-10b53db2db8dfda84b25833043f2b63123572af6.zip | |
scsi: core: Add a precondition check in scsi_eh_scmd_add()
Calling scsi_eh_scmd_add() may cause the error handler never to be woken up
because this may result in shost->host_failed to become larger than
scsi_host_busy(shost). Hence complain if scsi_eh_scmd_add() is called after
SCMD_STATE_INFLIGHT has been cleared.
Cc: Hannes Reinecke <[email protected]>
Cc: Damien Le Moal <[email protected]>
Cc: Mike Christie <[email protected]>
Cc: John Garry <[email protected]>
Cc: Ming Lei <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
| -rw-r--r-- | drivers/scsi/scsi_error.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index c67cdcdc3ba8..1bac12ef238e 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -301,6 +301,7 @@ void scsi_eh_scmd_add(struct scsi_cmnd *scmd) int ret; WARN_ON_ONCE(!shost->ehandler); + WARN_ON_ONCE(!test_bit(SCMD_STATE_INFLIGHT, &scmd->state)); spin_lock_irqsave(shost->host_lock, flags); if (scsi_host_set_state(shost, SHOST_RECOVERY)) { |
