From: Nigel Kirkland <nkirkland2304@gmail.com>
To: linux-scsi@vger.kernel.org, nigel.kirkland@broadcom.com
Cc: paul.ely@broadcom.com, nkirkland2304@gmail.com
Subject: [PATCH v5 05/10] lpfc: Add handling for when PLOGI or PRLI is dropped during link failure
Date: Mon, 28 Sep 2026 11:17:52 -0700 [thread overview]
Message-ID: <20260928181757.21959-6-nkirkland2304@gmail.com> (raw)
In-Reply-To: <20260928181757.21959-1-nkirkland2304@gmail.com>
PLOGI and PRLI typically complete via the lpfc_cmpl_els_plogi and
lpfc_cmpl_els_prli handler respectively, but when the link drops they
complete via the lpfc_cmpl_els_link_down handler. When this occurs, normal
cleanup completion actions are missed and we may fail to recover the login
session due to ndlp logistical mixups. Fix by clearing the NLP_PLOGI_SND
or NLP_PRLI_SND flag and decrement the outstanding prli_sent counters in
the lpfc_cmpl_els_link_down handler.
Signed-off-by: Nigel Kirkland <nkirkland2304@gmail.com>
---
drivers/scsi/lpfc/lpfc_els.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 45aad4cd2dc8..cd431c7bd9f0 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1230,6 +1230,8 @@ lpfc_cmpl_els_link_down(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
uint32_t *pcmd;
uint32_t cmd;
u32 ulp_status, ulp_word4;
+ struct lpfc_vport *vport = cmdiocb->vport;
+ struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
pcmd = (uint32_t *)cmdiocb->cmd_dmabuf->virt;
cmd = *pcmd;
@@ -1237,17 +1239,40 @@ lpfc_cmpl_els_link_down(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
ulp_status = get_job_ulpstatus(phba, rspiocb);
ulp_word4 = get_job_word4(phba, rspiocb);
- lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
- "6445 ELS completes after LINK_DOWN: "
- " Status %x/%x cmd x%x flg x%x iotag x%x\n",
- ulp_status, ulp_word4, cmd,
- cmdiocb->cmd_flag, cmdiocb->iotag);
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+ "6445 ELS completes after LINK_DOWN: "
+ "Status %x/%x cmd x%x data: x%x x%x x%x x%px x%px\n",
+ ulp_status, ulp_word4, cmd,
+ cmdiocb->cmd_flag, cmdiocb->iotag,
+ ndlp->nlp_state, vport, ndlp);
+
+ if (cmd == ELS_CMD_PLOGI) {
+ /* A PLOGI ELS IO needs to clear the PLOGI_SND flag to
+ * acknowledge the ELS completion and allow recovery. Otherwise
+ * a subsequent PLOGI gets rejected as a duplicate.
+ */
+ clear_bit(NLP_PLOGI_SND, &ndlp->nlp_flag);
+ } else if (cmd == ELS_CMD_PRLI || cmd == ELS_CMD_NVMEPRLI) {
+ /* A PRLI ELS IO needs to decrement the fc4_prli_sent count
+ * added by the lpfc_issue_els_prli function. A nonzero count
+ * stops transport registrations.
+ */
+ clear_bit(NLP_PRLI_SND, &ndlp->nlp_flag);
+ spin_lock_irq(&ndlp->lock);
+ vport->fc_prli_sent--;
+ ndlp->fc4_prli_sent--;
+ spin_unlock_irq(&ndlp->lock);
+ }
if (cmdiocb->cmd_flag & LPFC_IO_FABRIC) {
cmdiocb->cmd_flag &= ~LPFC_IO_FABRIC;
atomic_dec(&phba->fabric_iocb_count);
}
+
lpfc_els_free_iocb(phba, cmdiocb);
+
+ /* lpfc took a reference in the issue. Release it now. */
+ lpfc_nlp_put(ndlp);
}
/**
--
2.38.0
next prev parent reply other threads:[~2026-09-28 17:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 18:17 [PATCH v5 00/10] lpfc: Update lpfc to revision 15.0.0.1 Nigel Kirkland
2026-09-28 18:17 ` [PATCH v5 01/10] lpfc: Fix use-after-free in lpfc_cmpl_ct_cmd_vmid Nigel Kirkland
2026-09-28 18:17 ` [PATCH v5 02/10] lpfc: Early return out of lpfc_els_abort when HBA_SETUP flag is not set Nigel Kirkland
2026-09-28 18:17 ` [PATCH v5 03/10] lpfc: Fix kernel oops when unmapping scsi dma buffers for an aborted cmd Nigel Kirkland
2026-09-28 18:17 ` [PATCH v5 04/10] lpfc: Check fc4_xpt_flags before decrementing ndlp kref on FDISC error Nigel Kirkland
2026-09-28 18:19 ` sashiko-bot
2026-09-28 18:17 ` Nigel Kirkland [this message]
2026-09-28 18:17 ` [PATCH v5 05/10] lpfc: Add handling for when PLOGI or PRLI is dropped during link failure sashiko-bot
2026-09-28 18:17 ` [PATCH v5 06/10] lpfc: Fix ndlp use-after-free during repeated RSCN and rediscovery sequence Nigel Kirkland
2026-09-28 18:09 ` sashiko-bot
2026-09-28 18:17 ` [PATCH v5 07/10] lpfc: Rework I/O flush ordering when unloading driver Nigel Kirkland
2026-09-28 18:18 ` sashiko-bot
2026-09-28 18:17 ` [PATCH v5 08/10] lpfc: Refactor calls on fc_disctmo to lpfc_set_disctmo in RSCN handler Nigel Kirkland
2026-09-28 18:17 ` [PATCH v5 09/10] lpfc: Update correct ndlp refcnt when rejecting an unsolicited PLOGI Nigel Kirkland
2026-09-28 18:14 ` sashiko-bot
2026-09-28 18:17 ` [PATCH v5 10/10] lpfc: Update lpfc version to 15.0.0.1 Nigel Kirkland
2026-10-01 18:12 ` [PATCH v5 00/10] lpfc: Update lpfc to revision 15.0.0.1 Nigel Kirkland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928181757.21959-6-nkirkland2304@gmail.com \
--to=nkirkland2304@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nigel.kirkland@broadcom.com \
--cc=paul.ely@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.