From: Vaios Papadimitriou Date: Tue, 8 May 2012 22:01:27 +0000 (-0500) Subject: Fixed the system panic during EEH recovery (CR 127062) X-Git-Tag: v2.6.39-400.9.0~423^2~123^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8d4c1ea5c775e9e7de980eedc75ec2e359a3e3f8;p=users%2Fjedix%2Flinux-maple.git Fixed the system panic during EEH recovery (CR 127062) During the EEH recovery process while preparing for function reset, the mbox_sys_shutdown routine was invoked to shutdown driver's internal mailbox queue, including the pending (outstanding) mailbox command. There is a window for a race condition on the pending mailbox command handling when such mailbox command was just released by the lpfc_sli4_post_async_mbox due to unable to post such mailbox command because of PCI bus frozen. commit id: d7069f09884ac3924dacaabbc769cc0b4ee6ad40 Signed-off-by: Maxim Uvarov --- diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 28836d6eeaaf6..ee02dc21245b5 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7274,11 +7274,13 @@ lpfc_sli4_post_async_mbox(struct lpfc_hba *phba) out_not_finished: spin_lock_irqsave(&phba->hbalock, iflags); - mboxq->u.mb.mbxStatus = MBX_NOT_FINISHED; - __lpfc_mbox_cmpl_put(phba, mboxq); - /* Release the token */ - psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; - phba->sli.mbox_active = NULL; + if (phba->sli.mbox_active) { + mboxq->u.mb.mbxStatus = MBX_NOT_FINISHED; + __lpfc_mbox_cmpl_put(phba, mboxq); + /* Release the token */ + psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; + phba->sli.mbox_active = NULL; + } spin_unlock_irqrestore(&phba->hbalock, iflags); return MBX_NOT_FINISHED; @@ -9832,12 +9834,11 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba) unsigned long timeout; timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies; + spin_lock_irq(&phba->hbalock); psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; - spin_unlock_irq(&phba->hbalock); if (psli->sli_flag & LPFC_SLI_ACTIVE) { - spin_lock_irq(&phba->hbalock); /* Determine how long we might wait for the active mailbox * command to be gracefully completed by firmware. */ @@ -9856,7 +9857,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba) */ break; } - } + } else + spin_unlock_irq(&phba->hbalock); + lpfc_sli_mbox_sys_flush(phba); }