scsi: lpfc: Fix discovery failure when PLOGI is defered
authorJames Smart <jsmart2021@gmail.com>
Thu, 13 Dec 2018 23:17:55 +0000 (15:17 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 20 Dec 2018 03:13:07 +0000 (22:13 -0500)
When a target's link dropped, an RSCN was received to communicate the
change. The driver detected the loss of the target and issued and UNREG_RPI
mailbox command.  While that was being processed, another RSCN was received
to communicate the port coming back.  The driver deferred the PLOGI to the
port until the mailbox command finishes. When the mailbox command completed
it saw the pending port and called the routines to issue the
PLOGI. However, it forgot to clear the UNREG_INP state flag, so the PLOGI
xmt routine nooped the PLOGI request assuming it needed to wait for the
mailbox command.  At this point, login would never be re-attempted.

Clear UNREG_INP before issuing the deferred PLOGI.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_sli.c

index 4c1ba88b678a6ead1e914da20d77527193569b05..b183b882d50677ed8dab2c5c3ee0d1e88d9e8e7d 100644 (file)
@@ -4802,6 +4802,8 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                ndlp->nlp_flag &= ~NLP_UNREG_INP;
                ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
                lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
+       } else {
+               ndlp->nlp_flag &= ~NLP_UNREG_INP;
        }
 }
 
index 77a2d9cb745d9bb2cd950c7f25a82c1d7ad2bd83..f3cb6b4c52ff1004d408d77176d500a9902ad0e4 100644 (file)
@@ -2512,10 +2512,12 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 
                        if ((ndlp->nlp_flag & NLP_UNREG_INP) &&
                            (ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) {
+                               ndlp->nlp_flag &= ~NLP_UNREG_INP;
                                ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
                                lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
+                       } else {
+                               ndlp->nlp_flag &= ~NLP_UNREG_INP;
                        }
-                       ndlp->nlp_flag &= ~NLP_UNREG_INP;
                }
                pmb->ctx_ndlp = NULL;
        }
@@ -2583,12 +2585,14 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                                                "NPort x%x Data: x%x %p\n",
                                                ndlp->nlp_rpi, ndlp->nlp_DID,
                                                ndlp->nlp_defer_did, ndlp);
+                                       ndlp->nlp_flag &= ~NLP_UNREG_INP;
                                        ndlp->nlp_defer_did =
                                                NLP_EVT_NOTHING_PENDING;
                                        lpfc_issue_els_plogi(
                                                vport, ndlp->nlp_DID, 0);
+                               } else {
+                                       ndlp->nlp_flag &= ~NLP_UNREG_INP;
                                }
-                               ndlp->nlp_flag &= ~NLP_UNREG_INP;
                        }
                }
        }