* [PATCH v2] nvme: requeue keep-alive work when a Keep Alive fails
@ 2026-12-02 19:22 Andrew Stellman
0 siblings, 0 replies; only message in thread
From: Andrew Stellman @ 2026-12-02 19:22 UTC (permalink / raw)
To: Keith Busch, Christoph Hellwig, Sagi Grimberg
Cc: Jens Axboe, linux-nvme, linux-kernel
From: Andrew Stellman <astellman@stellman-greene.com>
When a Keep Alive fails, nvme_keep_alive_end_io() returns without
queueing ka_work again, so no more Keep Alives get sent and the target's
keep-alive timer expires even though the controller is still LIVE. Fix
this by requeueing ka_work in LIVE with nvme_queue_keep_alive_work(), so
a failed Keep Alive gets retried after the normal delay.
Fixes: 038bd4cb6766 ("nvme: add keep-alive support")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
v2: requeue only in LIVE, with the normal delay, after Sashiko's review
of v1. A failed Keep Alive in CONNECTING still stops keep-alive, as it
does today.
v1: https://lore.kernel.org/r/20261202163728.48705-1-bugs@stellman-greene.com
Tested on mainline 19cc08c1a6a6 in arm64 QEMU with KASAN over NVMe/TCP
loopback with a test-only nvmet error: before the fix the target's
keep-alive timer expired, and with it another Keep Alive arrived first.
Found with Quality Playbook
(https://github.com/andrewstellman/quality-playbook) running Claude
Opus 5.5; the fix was drafted with OpenAI GPT-6 (Codex).
A reproducer is available on request.
drivers/nvme/host/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f43582e5f6c4..58bae0e85a01 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1387,6 +1387,8 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq,
dev_err(ctrl->device,
"failed nvme_keep_alive_end_io error=%d\n",
status);
+ if (state == NVME_CTRL_LIVE)
+ nvme_queue_keep_alive_work(ctrl);
return RQ_END_IO_NONE;
}
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 19:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 19:22 [PATCH v2] nvme: requeue keep-alive work when a Keep Alive fails Andrew Stellman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®