Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John Meneghini <jmeneghi@redhat.com>
To: hare@suse.de, kbusch@kernel.org, martin.petersen@oracle.com,
	linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org
Cc: bgurney@redhat.com, axboe@kernel.dk, emilne@redhat.com,
	gustavoars@kernel.org, hch@lst.de, james.smart@broadcom.com,
	jmeneghi@redhat.com, kees@kernel.org,
	linux-hardening@vger.kernel.org, njavali@marvell.com,
	sagi@grimberg.me
Subject: [PATCH v10 03/11] nvme-fc: marginal path handling
Date: Thu, 25 Sep 2025 20:01:52 -0400	[thread overview]
Message-ID: <20250926000200.837025-4-jmeneghi@redhat.com> (raw)
In-Reply-To: <20250926000200.837025-1-jmeneghi@redhat.com>

From: Hannes Reinecke <hare@kernel.org>

FPIN LI (link integrity) messages are received when the attached
fabric detects hardware errors. In response to these messages I/O
should be directed away from the affected ports, and only used
if the 'optimized' paths are unavailable.
To handle this a new controller flag 'NVME_CTRL_MARGINAL' is added
which will cause the multipath scheduler to skip these paths when
checking for 'optimized' paths. They are, however, still eligible
for non-optimized path selected. The flag is cleared upon reset as then the
faulty hardware might be replaced.

Signed-off-by: Hannes Reinecke <hare@kernel.org>
Tested-by: Bryan Gurney <bgurney@redhat.com>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: Muneendra Kumar <muneendra.kumar@broadcom.com>
---
 drivers/nvme/host/fc.c        |  4 ++++
 drivers/nvme/host/multipath.c | 17 +++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 03987f497a5b..5091927c2176 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -786,6 +786,10 @@ nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl)
 		"Reconnect", ctrl->cnum);
 
 	set_bit(ASSOC_FAILED, &ctrl->flags);
+
+	/* clear 'marginal' flag as controller will be reset */
+	clear_bit(NVME_CTRL_MARGINAL, &ctrl->flags);
+
 	nvme_reset_ctrl(&ctrl->ctrl);
 }
 
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 3da980dc60d9..c042a9a11ce3 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -324,11 +324,14 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
 
 		switch (ns->ana_state) {
 		case NVME_ANA_OPTIMIZED:
-			if (distance < found_distance) {
-				found_distance = distance;
-				found = ns;
+			if (!nvme_ctrl_is_marginal(ns->ctrl)) {
+				if (distance < found_distance) {
+					found_distance = distance;
+					found = ns;
+				}
+				break;
 			}
-			break;
+			fallthrough;
 		case NVME_ANA_NONOPTIMIZED:
 			if (distance < fallback_distance) {
 				fallback_distance = distance;
@@ -381,7 +384,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head)
 
 		if (ns->ana_state == NVME_ANA_OPTIMIZED) {
 			found = ns;
-			goto out;
+			if (!nvme_ctrl_is_marginal(ns->ctrl))
+				goto out;
 		}
 		if (ns->ana_state == NVME_ANA_NONOPTIMIZED)
 			found = ns;
@@ -445,7 +449,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
 static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
 {
 	return nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE &&
-		ns->ana_state == NVME_ANA_OPTIMIZED;
+		ns->ana_state == NVME_ANA_OPTIMIZED &&
+		!nvme_ctrl_is_marginal(ns->ctrl);
 }
 
 static struct nvme_ns *nvme_numa_path(struct nvme_ns_head *head)
-- 
2.51.0



  parent reply	other threads:[~2025-09-26  0:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26  0:01 [PATCH v10 00/11] nvme-fc: FPIN link integrity handling John Meneghini
2025-09-26  0:01 ` [PATCH v10 01/11] fc_els: use 'union fc_tlv_desc' John Meneghini
2025-09-29 17:44   ` Justin Tee
2025-09-30 10:15     ` John Meneghini
2025-09-26  0:01 ` [PATCH v10 02/11] nvme: add NVME_CTRL_MARGINAL flag John Meneghini
2025-09-26  0:01 ` John Meneghini [this message]
2025-10-03 10:15   ` [PATCH v10 03/11] nvme-fc: marginal path handling Christoph Hellwig
2025-09-26  0:01 ` [PATCH v10 04/11] nvme: sysfs: emit the marginal path state in show_state() John Meneghini
2025-09-26  0:01 ` [PATCH v10 05/11] nvme-multipath: queue-depth support for marginal paths John Meneghini
2025-09-26  0:01 ` [PATCH v10 06/11] nvme-fc: add nvme_fc_modify_rport_fpin_state() John Meneghini
2025-09-26  0:01 ` [PATCH v10 07/11] scsi: scsi_transport_fc: add fc_host_fpin_set_nvme_rport_marginal() John Meneghini
2025-09-29 17:45   ` Justin Tee
2025-09-30 10:17     ` John Meneghini
2025-09-26  0:01 ` [PATCH v10 08/11] scsi: lpfc: enable FPIN notification for NVMe John Meneghini
2025-09-26  0:01 ` [PATCH v10 09/11] scsi: qla2xxx: " John Meneghini
2025-09-26  0:01 ` [PATCH v10 10/11] scsi: scsi_transport_fc: user support for clearing NVME_CTRL_MARGINAL John Meneghini
2025-09-26  0:02 ` [PATCH v10 11/11] scsi: qla2xxx: Fix 2 memcpy field-spanning write issue John Meneghini
2025-09-26  9:00   ` Gustavo A. R. Silva
2025-09-26  9:29     ` Hannes Reinecke
2025-09-30  9:38       ` John Meneghini
2025-09-30  9:24     ` John Meneghini

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=20250926000200.837025-4-jmeneghi@redhat.com \
    --to=jmeneghi@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bgurney@redhat.com \
    --cc=emilne@redhat.com \
    --cc=gustavoars@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.smart@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=njavali@marvell.com \
    --cc=sagi@grimberg.me \
    /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