aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDick Kennedy <dick.kennedy@broadcom.com>2017-11-07 15:59:02 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2017-11-08 18:25:12 -0500
commit341b2aa83368e6f23bf0cc3d04604896337ad7cb (patch)
treee7858cc574c7a7e1c7ac3eab3536f7fef90a5e16
parent268eb4989410619c39b041d453a05a71b26b24c6 (diff)
scsi: lpfc: Fix hard lock up NMI in els timeout handling.
System crashed due to a hard lockup at lpfc_els_timeout_handler+0x128. The els ring's txcmplq list is corrupted: the last element in the list does not point back the the head causing a loop. Issue is the els processing path for sli4 hbas are using the hbalock instead of the ring_lock for removing elements from the txcmplq list. Use the adapter SLI_REV to determine which lock should be used for removing iocbqs from the els rings txcmplq. note: the future refactoring will address this so that we don't have this ugly type-based lock code. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 8c37885f4851..98c488ab720b 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -2732,7 +2732,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2732 * 2732 *
2733 * This function looks up the iocb_lookup table to get the command iocb 2733 * This function looks up the iocb_lookup table to get the command iocb
2734 * corresponding to the given response iocb using the iotag of the 2734 * corresponding to the given response iocb using the iotag of the
2735 * response iocb. This function is called with the hbalock held. 2735 * response iocb. This function is called with the hbalock held
2736 * for sli3 devices or the ring_lock for sli4 devices.
2736 * This function returns the command iocb object if it finds the command 2737 * This function returns the command iocb object if it finds the command
2737 * iocb else returns NULL. 2738 * iocb else returns NULL.
2738 **/ 2739 **/
@@ -2828,9 +2829,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2828 unsigned long iflag; 2829 unsigned long iflag;
2829 2830
2830 /* Based on the iotag field, get the cmd IOCB from the txcmplq */ 2831 /* Based on the iotag field, get the cmd IOCB from the txcmplq */
2831 spin_lock_irqsave(&phba->hbalock, iflag); 2832 if (phba->sli_rev == LPFC_SLI_REV4)
2833 spin_lock_irqsave(&pring->ring_lock, iflag);
2834 else
2835 spin_lock_irqsave(&phba->hbalock, iflag);
2832 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); 2836 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq);
2833 spin_unlock_irqrestore(&phba->hbalock, iflag); 2837 if (phba->sli_rev == LPFC_SLI_REV4)
2838 spin_unlock_irqrestore(&pring->ring_lock, iflag);
2839 else
2840 spin_unlock_irqrestore(&phba->hbalock, iflag);
2834 2841
2835 if (cmdiocbp) { 2842 if (cmdiocbp) {
2836 if (cmdiocbp->iocb_cmpl) { 2843 if (cmdiocbp->iocb_cmpl) {