From 31e887864eb2c0cce3d0c448a7b1ef9792e850b7 Mon Sep 17 00:00:00 2001 From: James Smart Date: Tue, 12 Apr 2022 15:19:52 -0700 Subject: scsi: lpfc: Update fc_prli_sent outstanding only after guaranteed IOCB submit If lpfc_sli_issue_iocb() fails, then the fc_prli_sent is never decremented. Move the fc_prli_sent++ to after a guaranteed IOCB submit. Link: https://lore.kernel.org/r/20220412222008.126521-11-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen --- drivers/scsi/lpfc/lpfc_els.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_els.c') diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 44ef87324b80..8155c63d793c 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -2571,16 +2571,6 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, phba->fc_stat.elsXmitPRLI++; elsiocb->cmd_cmpl = lpfc_cmpl_els_prli; - spin_lock_irq(&ndlp->lock); - ndlp->nlp_flag |= NLP_PRLI_SND; - - /* The vport counters are used for lpfc_scan_finished, but - * the ndlp is used to track outstanding PRLIs for different - * FC4 types. - */ - vport->fc_prli_sent++; - ndlp->fc4_prli_sent++; - spin_unlock_irq(&ndlp->lock); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, "Issue PRLI: did:x%x refcnt %d", @@ -2588,16 +2578,25 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, elsiocb->context1 = lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); - goto err; + return 1; } rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0); if (rc == IOCB_ERROR) { lpfc_els_free_iocb(phba, elsiocb); lpfc_nlp_put(ndlp); - goto err; + return 1; } + /* The vport counters are used for lpfc_scan_finished, but + * the ndlp is used to track outstanding PRLIs for different + * FC4 types. + */ + spin_lock_irq(&ndlp->lock); + ndlp->nlp_flag |= NLP_PRLI_SND; + vport->fc_prli_sent++; + ndlp->fc4_prli_sent++; + spin_unlock_irq(&ndlp->lock); /* The driver supports 2 FC4 types. Make sure * a PRLI is issued for all types before exiting. @@ -2607,12 +2606,6 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, goto send_next_prli; else return 0; - -err: - spin_lock_irq(&ndlp->lock); - ndlp->nlp_flag &= ~NLP_PRLI_SND; - spin_unlock_irq(&ndlp->lock); - return 1; } /** -- cgit