From: sashiko-bot@kernel.org
To: "Justin Tee" <justintee8345@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 05/14] lpfc: Add handling for when PLOGI or PRLI is dropped during link failure
Date: Tue, 14 Jul 2026 01:02:09 +0000 [thread overview]
Message-ID: <20260714010209.CDC841F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260714011812.106753-6-justintee8345@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The vport-wide counter fc_prli_sent is modified under a node-specific spinlock (ndlp->lock), leading to data races during concurrent PRLI operations.
- [High] The patch only cleans up state flags for PLOGI and PRLI in the link down completion handler, completely missing identical cleanup requirements for LOGO and ADISC, which causes the session to remain irrecoverably stuck.
--
--- Patch [5]: [PATCH v3 05/14] lpfc: Add handling for when PLOGI or PRLI is dropped during link failure ---
commit ef308ec0ae24b6ee74db89f761bac77e41718c55
Author: Justin Tee <justintee8345@gmail.com>
lpfc: Add handling for when PLOGI or PRLI is dropped during link failure
This commit modifies the link down completion handler to clear the
NLP_PLOGI_SND and NLP_PRLI_SND flags and decrement the fc_prli_sent
counters. This ensures that normal cleanup actions are not missed when
PLOGI or PRLI commands are aborted due to a link failure. The fix
helps prevent recovery failures for login sessions.
> diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
> --- a/drivers/scsi/lpfc/lpfc_els.c
> +++ b/drivers/scsi/lpfc/lpfc_els.c
[ ... ]
> @@ -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);
>
[ ... ]
> + 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) {
[Severity: High]
This isn't a bug introduced by this patch, but does this handler also need to
clean up state flags for LOGO and ADISC?
If a LOGO or ADISC ELS command is aborted by a link down event and routed to
lpfc_cmpl_els_link_down(), it appears the NLP_LOGO_SND and NLP_ADISC_SND
flags are not cleared.
Could this permanently block subsequent connection or management commands to
this node? For example, would lpfc_rcv_plogi() silently ignore incoming PLOGIs
if NLP_LOGO_SND remains set?
> + /* 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);
[Severity: High]
This is a pre-existing issue, but can modifying the shared vport-wide counter
vport->fc_prli_sent under a localized node-specific lock (ndlp->lock) lead to
data races?
If concurrent ELS PRLI completions or issues on different nodes within the same
virtual port occur, each thread might acquire its own localized ndlp->lock and
perform a read-modify-write on vport->fc_prli_sent without mutual exclusion.
Could this lost update leave the counter permanently non-zero, causing
lpfc_scan_finished() to hang indefinitely and block SCSI device discovery?
> }
>
> if (cmdiocb->cmd_flag & LPFC_IO_FABRIC) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714011812.106753-1-justintee8345@gmail.com?part=5
next prev parent reply other threads:[~2026-07-14 1:02 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 1:17 [PATCH v3 00/14] Update lpfc to revision 15.0.0.1 Justin Tee
2026-07-14 1:17 ` [PATCH v3 01/14] lpfc: Fix use-after-free in lpfc_cmpl_ct_cmd_vmid Justin Tee
2026-07-14 0:51 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 02/14] lpfc: Early return out of lpfc_els_abort when HBA_SETUP flag is not set Justin Tee
2026-07-14 0:53 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 03/14] lpfc: Fix kernel oops when unmapping scsi dma buffers for an aborted cmd Justin Tee
2026-07-14 0:57 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 04/14] lpfc: Check fc4_xpt_flags before decrementing ndlp kref on FDISC error Justin Tee
2026-07-14 0:55 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 05/14] lpfc: Add handling for when PLOGI or PRLI is dropped during link failure Justin Tee
2026-07-14 1:02 ` sashiko-bot [this message]
2026-07-14 1:18 ` [PATCH v3 06/14] lpfc: Fix ndlp use-after-free during repeated RSCN and rediscovery sequence Justin Tee
2026-07-14 0:50 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 07/14] lpfc: Rework I/O flush ordering when unloading driver Justin Tee
2026-07-14 1:00 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 08/14] lpfc: Improve PLOGI retry handling for large SAN configurations Justin Tee
2026-07-14 0:55 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 09/14] lpfc: Send inhibited ABORT_WQE when PLOGI CQE SEQUENCE_TMO is received Justin Tee
2026-07-14 1:05 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 10/14] lpfc: Remove slowpath cqe process limiter in slow ring event handler Justin Tee
2026-07-14 0:54 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 11/14] lpfc: Put iocbq on phba->txq when ELS WQ is full or ELS SGL unavailable Justin Tee
2026-07-14 0:50 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 12/14] lpfc: Update ELS ACC logging for diagnostic troubleshooting Justin Tee
2026-07-14 1:02 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 13/14] lpfc: Refactor calls on fc_disctmo to lpfc_set_disctmo in RSCN handler Justin Tee
2026-07-14 1:00 ` sashiko-bot
2026-07-14 1:18 ` [PATCH v3 14/14] lpfc: Update lpfc version to 15.0.0.1 Justin Tee
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=20260714010209.CDC841F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=justintee8345@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox