Re: [PATCH v3] nvme-multipath: add fail_if_no_path sysfs attribute
From: Hannes Reinecke
Date: Wed Sep 23 2026 - 08:12:16 EST
On 9/23/26 2:49 AM, Krishna Iyer wrote:
When no usable path exists, I/O on a multipath namespace is queued[ .. ]
until a path returns. With ctrl_loss_tmo=-1 that can be forever:
during a long fabric outage any process waiting on the I/O is stuck in
D state. We hit this on virtualization hosts, where a SIGKILLed VM
process cannot exit while draining I/O to an unreachable NVMe/TCP
target.
Nothing can fail this I/O without tearing something down: controller
deletion takes every namespace on the controller with it.
Add a fail_if_no_path attribute on the ns-head disk: a persistent
per-namespace policy to fail parked and newly arriving I/O instead of
queueing it when no usable path exists. It is enforced where a path is
known to be unusable: CONNECTING controllers and LIVE controllers with
the path ANA inaccessible or persistent-loss stop counting as
available, RESETTING and ANA change keep queueing, and with no
controllers left the policy overrides the delayed_removal_secs
queueing window. Controller state is untouched and reconnects
continue. Like dm's fail_if_no_path, the policy is transport agnostic.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Krishna Iyer <kiyer@xxxxxxxxx>
---
Changes since v2 [1]:
- use the nvme_state_is_live() helper for the ANA state check, keeping
the explicit NVME_ANA_CHANGE carve-out so transient ANA transitions
still queue (Nilay)
- return early when the stored value matches the current setting,
skipping synchronize_srcu() and the requeue kick (Nilay)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index a643c4723a69..9773538101ca 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -590,6 +590,7 @@ struct nvme_ns_head {
#define NVME_NSHEAD_DISK_LIVE 0
#define NVME_NSHEAD_QUEUE_IF_NO_PATH 1
#define NVME_NSHEAD_CDEV_LIVE 2
+#define NVME_NSHEAD_FAIL_IF_NO_PATH 3
struct nvme_ns __rcu_guarded *current_path[];
#endif
};
Remind me again: what is the meaning of 'NVME_NSHEAD_QUEUE_IF_NO_PATH'?
Isn't this the exact opposite of the proposed
'NVME_NSHEAD_FAIL_IF_NO_PATH'?
IOW can't you rewrite this patch to use the existing 'NVME_NSHEAD_QUEUE_IF_NO_PATH' flag instead of adding another?
(And if you have to introduce 'FAIL_IF_NO_PATH' you'd have to explain
what exactly should happen if QUEUE_IF_NO_PATH _and_ FAIL_IF_NO_PATH
are set ...)
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich