Commit ee92a94d authored by Brian King's avatar Brian King Committed by Luis Henriques

ipr: Fix locking for unit attention handling

commit 36b8e180 upstream.

Make sure we have the host lock held when calling scsi_report_bus_reset. Fixes
a crash seen as the __devices list in the scsi host was changing as we were
iterating through it.
Reviewed-by: default avatarWen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: default avatarGabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 929e4e37
...@@ -6217,21 +6217,23 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) ...@@ -6217,21 +6217,23 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd)
struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc);
unsigned long hrrq_flags; unsigned long lock_flags;
scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len)); scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len));
if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) { if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {
scsi_dma_unmap(scsi_cmd); scsi_dma_unmap(scsi_cmd);
spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags);
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
scsi_cmd->scsi_done(scsi_cmd); scsi_cmd->scsi_done(scsi_cmd);
spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags);
} else { } else {
spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
spin_lock(&ipr_cmd->hrrq->_lock);
ipr_erp_start(ioa_cfg, ipr_cmd); ipr_erp_start(ioa_cfg, ipr_cmd);
spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); spin_unlock(&ipr_cmd->hrrq->_lock);
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment