From: sashiko-bot@kernel.org
To: "Mohamed Khalfella" <mkhalfella@purestorage.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH v7 07/17] nvme: Introduce FENCING and FENCED controller states
Date: Sat, 14 Nov 2026 03:29:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-214110@kernel.org> (raw)
In-Reply-To: <20261114030454.2836543-8-mkhalfella@purestorage.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] nvme: premature non-mpath I/O failure in
nvme_fail_nonready_command()
- [Medium] nvme: live queues re-enabled in nvme_check_ready() when
deleting from FENCING
--
commit 78ddca4023a9ef3590c04ed05791d87621f68277
Author: Mohamed Khalfella <mkhalfella@purestorage.com>
nvme: Introduce FENCING and FENCED controller states
This commit adds the NVME_CTRL_FENCING and NVME_CTRL_FENCED controller
states along with their state machine transitions, readiness checks,
multipath path availability handling, and sysfs state names.
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 38b27d8db0119..4be3ce2e72a78 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
[ ... ]
> @@ -622,6 +641,8 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
> case NVME_CTRL_LIVE:
> case NVME_CTRL_RESETTING:
> case NVME_CTRL_CONNECTING:
> + case NVME_CTRL_FENCING:
> + case NVME_CTRL_FENCED:
> changed = true;
> fallthrough;
> default:
[Severity: Medium]
When a controller in NVME_CTRL_FENCING or NVME_CTRL_FENCED transitions
to NVME_CTRL_DELETING, can new I/O be dispatched onto its still-live
queues while nvme_stop_ctrl() waits for fencing to finish?
While in NVME_CTRL_FENCING, the transport queues remain live and new
requests are blocked only because __nvme_check_ready() and
nvme_path_get_state() reject NVME_CTRL_FENCING and NVME_CTRL_FENCED.
In nvme_do_delete_ctrl(), ctrl->state stays NVME_CTRL_DELETING across
nvme_stop_ctrl() until nvme_remove_namespaces() sets
NVME_CTRL_DELETING_NOIO, and both nvme_check_ready() and
nvme_path_get_state() treat NVME_CTRL_DELETING on a live queue as ready
and enabled:
drivers/nvme/host/nvme.h:nvme_check_ready() {
if (likely(state == NVME_CTRL_LIVE))
return true;
if (ctrl->ops->flags & NVME_F_FABRICS && state == NVME_CTRL_DELETING)
return queue_live;
return __nvme_check_ready(ctrl, rq, queue_live, state);
}
drivers/nvme/host/multipath.c:nvme_path_get_state() {
if (state != NVME_CTRL_LIVE && state != NVME_CTRL_DELETING)
return NVME_PATH_DISABLED_CTRL_DOWN;
}
As a result, deleting a fencing controller re-enables multipath
selection and allows new requests to be queued to the broken controller
throughout the fence wait instead of failing over immediately.
> @@ -786,6 +807,8 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl,
>
> if (state != NVME_CTRL_DELETING_NOIO &&
> state != NVME_CTRL_DELETING &&
> + state != NVME_CTRL_FENCING &&
> + state != NVME_CTRL_FENCED &&
> state != NVME_CTRL_DEAD &&
> !test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) &&
> !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH))
[Severity: High]
Does excluding NVME_CTRL_FENCING and NVME_CTRL_FENCED here cause
non-multipath I/O to fail immediately with BLK_STS_TRANSPORT during
fencing?
Multipath requests (REQ_NVME_MPATH or REQ_FAILFAST_TRANSPORT) already
bypass the BLK_STS_RESOURCE return via the trailing checks and call
nvme_host_path_error(rq), so excluding NVME_CTRL_FENCING and
NVME_CTRL_FENCED here only changes the behavior for normal
non-multipath requests. Because the queues are not quiesced during
NVME_CTRL_FENCING, nvme_host_path_error() -> nvme_complete_rq() ->
nvme_decide_disposition() returns RETRY, and nvme_retry_req() requeues
the request with zero delay until nvme_max_retries is exhausted in a
tight loop, after which __nvme_end_req() logs an uninitialized
nr->cmd->common.opcode in nvme_log_error() (since nvme_check_ready()
failed before nvme_setup_cmd()) and fails the I/O to the caller.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261114030454.2836543-1-mkhalfella@purestorage.com?part=7
next prev parent reply other threads:[~2026-11-14 3:29 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 3:04 [PATCH v7 00/17] TP8028 Rapid Path Failure Recovery Mohamed Khalfella
2026-11-14 3:04 ` [PATCH v7 01/17] nvmet: Rapid Path Failure Recovery set controller identify fields Mohamed Khalfella
2026-11-14 3:17 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 02/17] nvmet/debugfs: Export controller CIU and CIRN via debugfs Mohamed Khalfella
2026-11-14 3:12 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 03/17] nvmet: Implement CCR nvme command Mohamed Khalfella
2026-11-14 3:30 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 04/17] nvmet: Implement CCR logpage Mohamed Khalfella
2026-11-14 3:20 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 05/17] nvmet: Send an AEN on CCR completion Mohamed Khalfella
2026-11-14 3:04 ` [PATCH v7 06/17] nvme: Rapid Path Failure Recovery read controller identify fields Mohamed Khalfella
2026-11-14 3:04 ` [PATCH v7 07/17] nvme: Introduce FENCING and FENCED controller states Mohamed Khalfella
2026-11-14 3:29 ` sashiko-bot [this message]
2026-11-14 3:04 ` [PATCH v7 08/17] nvme: Implement cross-controller reset recovery Mohamed Khalfella
2026-11-14 3:26 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 09/17] nvme: Implement cross-controller reset completion Mohamed Khalfella
2026-11-14 3:29 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 10/17] nvme-tcp: Use CCR to recover controller that hits an error Mohamed Khalfella
2026-11-14 3:38 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 11/17] nvme-rdma: " Mohamed Khalfella
2026-11-14 3:04 ` [PATCH v7 12/17] nvme-fc: start error recovery instead of aborting timed out IOs Mohamed Khalfella
2026-11-14 3:46 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 13/17] nvme-fc: perform error recovery directly from ioerr_work Mohamed Khalfella
2026-11-14 3:31 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 14/17] nvme-fc: Use CCR to recover controller that hits an error Mohamed Khalfella
2026-11-14 3:38 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 15/17] nvme-fc: Hold inflight requests while in FENCING state Mohamed Khalfella
2026-11-14 4:06 ` sashiko-bot
2026-11-14 3:04 ` [PATCH v7 16/17] nvmet: Add support for CQT to nvme target Mohamed Khalfella
2026-11-14 3:04 ` [PATCH v7 17/17] nvme: Add support for CQT to nvme host Mohamed Khalfella
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=sashiko-outbox-214110@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mkhalfella@purestorage.com \
--cc=sashiko-reviews@lists.linux.dev \
/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