Re: [PATCH v2 1/2] nvme-multipath: fail queued I/O when delayed_removal_secs is cleared

From: Hannes Reinecke

Date: Fri Nov 13 2026 - 14:30:58 EST


On 11/11/26 2:10 PM, Qiliang Yuan wrote:
With delayed_removal_secs set, bios submitted after the last path goes
away are queued on head->requeue_list, in case a path comes back before
the delayed removal of the head.

Writing 0 to delayed_removal_secs clears NVME_NSHEAD_QUEUE_IF_NO_PATH
but doesn't kick the requeue work, so the bios already queued stay
there until the removal work runs, up to the old delay later, instead
of failing right away.

Kick the requeue work when the attribute is cleared, as
fail_on_ctrl_loss_store() does when it is set, so that the queued bios
are resubmitted and fail.

With delayed_removal_secs at 30 and no path left, a direct read is
queued and delayed_removal_secs cleared two seconds later. The read
then fails after (mean of two runs, min-max in parentheses):

before (ms) after (ms) change
26234 (26209-26258) 3.5 (3-4) -99.99%

Fixes: 62188639ec160 ("nvme-multipath: introduce delayed removal of the multipath head node")
Signed-off-by: Qiliang Yuan <qiliang.yuan@xxxxxxxxx>
---
drivers/nvme/host/multipath.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index ae8059366b57d..a92a05b1f925a 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -1249,6 +1249,10 @@ static ssize_t delayed_removal_secs_store(struct device *dev,
*/
synchronize_srcu(&head->srcu);
+ /* Fail the I/O queued while waiting for a path to come back */
+ if (!sec)
+ kblockd_schedule_work(&head->requeue_work);
+
return count;
}


Reviewed-by: Hannes Reinecke <hare@xxxxxxxxxx>

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