From: Andrew Stellman <bugs@stellman-greene.com>
To: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] nvme: requeue keep-alive work when a Keep Alive fails
Date: Wed, 2 Dec 2026 11:37:28 -0500 [thread overview]
Message-ID: <20261202163728.48705-1-bugs@stellman-greene.com> (raw)
From: Andrew Stellman <astellman@stellman-greene.com>
When a Keep Alive command completes with an error,
nvme_keep_alive_end_io() logs it and returns without requeueing
ctrl->ka_work, so no further Keep Alives are sent while the controller
stays LIVE. With a test-only nvmet change that failed one Keep Alive,
the target's keep-alive timer expired.
Requeue ka_work on the error path under the same LIVE/CONNECTING check
the success path uses.
Found with Quality Playbook
(https://github.com/andrewstellman/quality-playbook).
Fixes: 038bd4cb6766 ("nvme: add keep-alive support")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
This changes behavior: after a Keep Alive error in LIVE or CONNECTING,
Keep Alives now continue instead of stopping.
Tested on mainline 7.4.0-rc5 (19cc08c1a6a6) in arm64 QEMU with KASAN,
NVMe/TCP loopback to nvmet with keep_alive_tmo=6, using a test-only
nvmet change that fails one Keep Alive with Internal Error/DNR. Without
the patch no further Keep Alive was sent before the target's keep-alive
timer expired; with it the next Keep Alive arrived about 3 seconds later
and the controller stayed LIVE. No other status, transport or the
CONNECTING case was tested.
I found this issue running Quality Playbook with Claude Opus 5.5. The
fix was drafted with OpenAI GPT-6 (Codex), and this changelog with
OpenAI GPT-6 (Codex) and Claude Sonnet 5.5; both were reviewed by me. 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..ca04ff0f437d 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 || state == NVME_CTRL_CONNECTING)
+ queue_delayed_work(nvme_wq, &ctrl->ka_work, delay);
return RQ_END_IO_NONE;
}
--
2.53.0
next reply other threads:[~2026-12-02 16:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 16:37 Andrew Stellman [this message]
2026-12-02 16:49 Andrew Stellman
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=20261202163728.48705-1-bugs@stellman-greene.com \
--to=bugs@stellman-greene.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--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
all inboxes | Powered by JetHome®