[PATCH 5.10 357/491] Revert "scsi: core: Wake up the error handler when final completions race against each other"

Greg Kroah-Hartman
2026-04-13T16:59:28Z

This reverts commit cc872e35c0df80062abc71268d690a2f749e542e.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_error.c | 11 +----------
drivers/scsi/scsi_lib.c | 8 --------
2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 4e9114f069832..ffc6f3031e82b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -241,20 +241,11 @@ static void scsi_eh_inc_host_failed(struct rcu_head *head)
{
struct scsi_cmnd *scmd = container_of(head, typeof(*scmd), rcu);
struct Scsi_Host *shost = scmd->device->host;
- unsigned int busy;
+ unsigned int busy = scsi_host_busy(shost);
unsigned long flags;

spin_lock_irqsave(shost->host_lock, flags);
shost->host_failed++;
- spin_unlock_irqrestore(shost->host_lock, flags);
- /*
- * The counting of busy requests needs to occur after adding to
- * host_failed or after the lock acquire for adding to host_failed
- * to prevent a race with host unbusy and missing an eh wakeup.
- */
- busy = scsi_host_busy(shost);
-
- spin_lock_irqsave(shost->host_lock, flags);
scsi_eh_wakeup(shost, busy);
spin_unlock_irqrestore(shost->host_lock, flags);
}
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8d570632982f3..fb48d47e9183e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -310,14 +310,6 @@ static void scsi_dec_host_busy(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
rcu_read_lock();
__clear_bit(SCMD_STATE_INFLIGHT, &cmd->state);
if (unlikely(scsi_host_in_recovery(shost))) {
- /*
- * Ensure the clear of SCMD_STATE_INFLIGHT is visible to
- * other CPUs before counting busy requests. Otherwise,
- * reordering can cause CPUs to race and miss an eh wakeup
- * when no CPU sees all busy requests as done or timed out.
- */
- smp_mb();
-
unsigned int busy = scsi_host_busy(shost);

spin_lock_irqsave(shost->host_lock, flags);
--
2.53.0