* [PATCH 1/3] [RESEND] ipr: Fix locking for unit attention handling
@ 2015-07-14 16:41 Brian King
2015-07-17 1:57 ` Martin K. Petersen
0 siblings, 1 reply; 3+ messages in thread
From: Brian King @ 2015-07-14 16:41 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi, brking, stable, krisman, wenxiong
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.
Cc: <stable@vger.kernel.org>
Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
drivers/scsi/ipr.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff -puN drivers/scsi/ipr.c~ipr_erp_start_locking drivers/scsi/ipr.c
--- linux/drivers/scsi/ipr.c~ipr_erp_start_locking 2015-07-14 11:10:18.015330839 -0500
+++ linux-bjking1/drivers/scsi/ipr.c 2015-07-14 11:10:50.445165558 -0500
@@ -6263,21 +6263,23 @@ static void ipr_scsi_done(struct ipr_cmn
struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
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));
if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {
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);
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 {
- 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);
- 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);
}
}
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] [RESEND] ipr: Fix locking for unit attention handling
2015-07-14 16:41 [PATCH 1/3] [RESEND] ipr: Fix locking for unit attention handling Brian King
@ 2015-07-17 1:57 ` Martin K. Petersen
2015-07-17 13:02 ` Brian King
0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2015-07-17 1:57 UTC (permalink / raw)
To: Brian King; +Cc: James.Bottomley, linux-scsi, stable, krisman, wenxiong
>>>>> "Brian" == Brian King <brking@linux.vnet.ibm.com> writes:
Brian> Make sure we have the host lock held when calling
Brian> scsi_report_bus_reset. Fixes a crash seen as the __devices list
Brian> in the scsi host was changing as we were iterating through it.
Nit: I take it that renaming lock_flags to hrrq_flags makes sense. But
it muddles what is supposed to be a bugfix patch.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] [RESEND] ipr: Fix locking for unit attention handling
2015-07-17 1:57 ` Martin K. Petersen
@ 2015-07-17 13:02 ` Brian King
0 siblings, 0 replies; 3+ messages in thread
From: Brian King @ 2015-07-17 13:02 UTC (permalink / raw)
To: Martin K. Petersen; +Cc: James.Bottomley, linux-scsi, stable, krisman, wenxiong
On 07/16/2015 08:57 PM, Martin K. Petersen wrote:
>>>>>> "Brian" == Brian King <brking@linux.vnet.ibm.com> writes:
>
> Brian> Make sure we have the host lock held when calling
> Brian> scsi_report_bus_reset. Fixes a crash seen as the __devices list
> Brian> in the scsi host was changing as we were iterating through it.
>
> Nit: I take it that renaming lock_flags to hrrq_flags makes sense. But
> it muddles what is supposed to be a bugfix patch.
>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
>
Correct. Thanks for the review.
-Brian
--
Brian King
Power Linux I/O
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-17 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 16:41 [PATCH 1/3] [RESEND] ipr: Fix locking for unit attention handling Brian King
2015-07-17 1:57 ` Martin K. Petersen
2015-07-17 13:02 ` Brian King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.