Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nilesh Javali" <njavali@marvell.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 04/13] scsi: qla2xxx: Wait for session deletion before full-login LIP
Date: Fri, 23 Oct 2026 10:35:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-182694@kernel.org> (raw)
In-Reply-To: <20261023101600.1431179-5-njavali@marvell.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] scsi: qla2xxx: qla2x00_loop_reset() stalls 10s and skips FCP-2 session deletion
--

commit 58a127391fc6a3fa18dd4432ba3a5356192f9875
Author: Manish Rangankar <mrangankar@marvell.com>

scsi: qla2xxx: Wait for session deletion before full-login LIP

This commit replaces qla2x00_mark_all_devices_lost() with
qla2x00_wait_for_sess_deletion() in qla2x00_loop_reset() so that fcport
session deletions and workqueue items complete before issuing a full-login
LIP mailbox command.

> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index c0efdbff5da71..0e5e672e81ee6 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1752,7 +1752,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
>  	if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) {
>  		atomic_set(&vha->loop_state, LOOP_DOWN);
>  		atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
> -		qla2x00_mark_all_devices_lost(vha);
> +		qla2x00_wait_for_sess_deletion(vha);
>  		ret = qla2x00_full_login_lip(vha);

[Severity: Medium]
When a logged-in FCP-2 target (FCF_FCP2_DEVICE) is present and ql2xfc2target
is enabled (which defaults to 1), will calling
qla2x00_wait_for_sess_deletion() from qla2x00_loop_reset() stall for the full
10-second timeout and still leave the FCP-2 session undeleted when
qla2x00_full_login_lip() is issued?

qla2x00_loop_reset() is called from qla2xxx_eh_bus_reset() (after
qla2x00_wait_for_hba_online() has waited for ISP abort flags to clear) and
from sysfs qla2x00_issue_lip(). In both paths, qla2x00_reset_active(vha) is
false.

When qla2x00_loop_reset() -> qla2x00_wait_for_sess_deletion() calls
qla2x00_mark_all_devices_lost(), any logged-in FCP-2 target is skipped
because !qla2x00_reset_active(vha) is true:

drivers/scsi/qla2xxx/qla_os.c:qla2x00_mark_all_devices_lost() {
	list_for_each_entry(fcport, &vha->vp_fcports, list) {
		if (ql2xfc2target &&
		    fcport->loop_id != FC_NO_LOOP_ID &&
		    (fcport->flags & FCF_FCP2_DEVICE) &&
		    fcport->port_type == FCT_TARGET &&
		    !qla2x00_reset_active(vha)) {
			ql_dbg(ql_dbg_disc, vha, 0x211a,
			       "Delaying session delete for FCP2 flags 0x%x port_type = 0x%x port_id=%06x %phC",
			       fcport->flags, fcport->port_type,
			       fcport->d_id.b24, fcport->port_name);
			continue;
		}
		fcport->scan_state = 0;
		qlt_schedule_sess_for_deletion(fcport);
	}
}

Because qlt_schedule_sess_for_deletion(fcport) is skipped and
qla2x00_full_login_lip(vha) has not been sent yet, vha->fcport_count remains
non-zero and fcport->deleted remains 0. As a result, test_fcport_count(vha)
never becomes true in qla2x00_wait_for_sess_deletion():

drivers/scsi/qla2xxx/qla_os.c:qla2x00_wait_for_sess_deletion() {
	qla2x00_mark_all_devices_lost(vha);

	for (i = 0; i < 10; i++) {
		if (wait_event_timeout(vha->fcport_waitQ,
		    test_fcport_count(vha), HZ) > 0)
			break;
	}

	flush_workqueue(vha->hw->wq);
}

After blocking for all 10 iterations (10 * HZ), qla2x00_full_login_lip(vha)
proceeds with the FCP-2 fcport still in DSC_LOGIN_COMPLETE. If the N2N peer
is an FCP-2 target, RIDA processing in qla24xx_report_id_acquisition() will
then hit the default branch and call qlt_schedule_sess_for_deletion(fcport)
(placing it in DSC_DELETE_PEND) right as N2N_LOGIN_NEEDED is set:

drivers/scsi/qla2xxx/qla_mbx.c:qla24xx_report_id_acquisition() {
				switch (fcport->disc_state) {
				case DSC_DELETED:
					set_bit(RELOGIN_NEEDED,
					    &vha->dpc_flags);
					break;
				case DSC_DELETE_PEND:
					break;
				default:
					qlt_schedule_sess_for_deletion(fcport);
					break;
				}
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261023101600.1431179-1-njavali@marvell.com?part=4

  reply	other threads:[~2026-10-23 10:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 10:15 [PATCH v2 00/13] scsi: qla2xxx: Misc. Bug fixes Nilesh Javali
2026-10-23 10:15 ` [PATCH v2 01/13] scsi: qla2xxx: Update MAINTAINERS with new FC storage alias Nilesh Javali
2026-10-23 10:15 ` [PATCH v2 02/13] scsi: qla2xxx: Update few AENs for 29xx handling Nilesh Javali
2026-10-23 10:36   ` sashiko-bot
2026-10-23 10:15 ` [PATCH v2 03/13] Revert "scsi: qla2xxx: Validate BSG request_len before reading vendor_cmd[]" Nilesh Javali
2026-10-23 10:33   ` sashiko-bot
2026-10-23 10:15 ` [PATCH v2 04/13] scsi: qla2xxx: Wait for session deletion before full-login LIP Nilesh Javali
2026-10-23 10:35   ` sashiko-bot [this message]
2026-10-23 10:15 ` [PATCH v2 05/13] scsi: qla2xxx: Fix double addition of fcport to gnl.fcport list Nilesh Javali
2026-10-23 10:38   ` sashiko-bot
2026-10-23 10:15 ` [PATCH v2 06/13] scsi: qla2xxx: Fix scan state machine race and IRQ-unsafe sp_unmap Nilesh Javali
2026-10-23 10:34   ` sashiko-bot
2026-10-23 10:15 ` [PATCH v2 07/13] scsi: qla2xxx: Skip vport DPC processing during vport deletion Nilesh Javali
2026-10-23 10:15 ` [PATCH v2 08/13] scsi: qla2xxx: Add validation check for base vport index during delete Nilesh Javali
2026-10-23 10:15 ` [PATCH v2 09/13] scsi: qla2xxx: Validate vport before deletion Nilesh Javali
2026-10-23 10:15 ` [PATCH v2 10/13] scsi: qla2xxx: Fix use-after-free races during vport deletion Nilesh Javali
2026-10-23 10:53   ` sashiko-bot
2026-10-23 10:15 ` [PATCH v2 11/13] scsi: qla2xxx: Re-acquire vport_slock and refresh tvp during vport DPC Nilesh Javali
2026-10-23 10:53   ` sashiko-bot
2026-10-23 10:15 ` [PATCH v2 12/13] scsi: qla2xxx: Fix purex IOCB copy size on non-29xx adapters Nilesh Javali
2026-10-23 10:43   ` sashiko-bot
2026-10-23 10:16 ` [PATCH v2 13/13] scsi: qla2xxx: Update version to 12.00.00.2610b1 Nilesh Javali

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=sashiko-outbox-182694@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=njavali@marvell.com \
    --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