]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fixed the system panic during EEH recovery (CR 127062)
authorVaios Papadimitriou <vaios.papadimitriou@emulex.com>
Tue, 8 May 2012 22:01:27 +0000 (17:01 -0500)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Wed, 9 May 2012 00:01:27 +0000 (17:01 -0700)
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 <maxim.uvarov@oracle.com>
drivers/scsi/lpfc/lpfc_sli.c

index 28836d6eeaaf6bb0be6b62b644eaa3224406177e..ee02dc21245b5c7d4c42679282290dbee9d1e0ca 100644 (file)
@@ -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);
 }