mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
scsi: core: Move scsi_host_busy() out of host lock if it is for per-command
Commit4373534a98
("scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler") intended to fix a hard lockup issue triggered by EH. The core idea was to move scsi_host_busy() out of the host lock when processing individual commands for EH. However, a suggested style change inadvertently caused scsi_host_busy() to remain under the host lock. Fix this by calling scsi_host_busy() outside the lock. Fixes:4373534a98
("scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler") Cc: Sathya Prakash Veerichetty <safhya.prakash@broadcom.com> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20240203024521.2006455-1-ming.lei@redhat.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
f4469f3858
commit
4e6c901199
@ -282,11 +282,12 @@ static void scsi_eh_inc_host_failed(struct rcu_head *head)
|
|||||||
{
|
{
|
||||||
struct scsi_cmnd *scmd = container_of(head, typeof(*scmd), rcu);
|
struct scsi_cmnd *scmd = container_of(head, typeof(*scmd), rcu);
|
||||||
struct Scsi_Host *shost = scmd->device->host;
|
struct Scsi_Host *shost = scmd->device->host;
|
||||||
|
unsigned int busy = scsi_host_busy(shost);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(shost->host_lock, flags);
|
spin_lock_irqsave(shost->host_lock, flags);
|
||||||
shost->host_failed++;
|
shost->host_failed++;
|
||||||
scsi_eh_wakeup(shost, scsi_host_busy(shost));
|
scsi_eh_wakeup(shost, busy);
|
||||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,9 +278,11 @@ static void scsi_dec_host_busy(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
|
|||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
__clear_bit(SCMD_STATE_INFLIGHT, &cmd->state);
|
__clear_bit(SCMD_STATE_INFLIGHT, &cmd->state);
|
||||||
if (unlikely(scsi_host_in_recovery(shost))) {
|
if (unlikely(scsi_host_in_recovery(shost))) {
|
||||||
|
unsigned int busy = scsi_host_busy(shost);
|
||||||
|
|
||||||
spin_lock_irqsave(shost->host_lock, flags);
|
spin_lock_irqsave(shost->host_lock, flags);
|
||||||
if (shost->host_failed || shost->host_eh_scheduled)
|
if (shost->host_failed || shost->host_eh_scheduled)
|
||||||
scsi_eh_wakeup(shost, scsi_host_busy(shost));
|
scsi_eh_wakeup(shost, busy);
|
||||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user