[PATCH v7 07/17] nvme: Introduce FENCING and FENCED controller states
Dmitry Bogdanov
d.bogdanov at yadro.com
Thu Dec 3 09:31:02 PST 2026
Hi Mohamed.
On Fri, Nov 13, 2026 at 07:04:21PM -0800, Mohamed Khalfella wrote:
>
> Introduce two new controller states, FENCING and FENCED, and the state
> machine transitions needed to support them. Transports will move a LIVE
> controller into these states when an error is encountered; this patch
> only adds the states themselves.
>
> FENCING is entered from LIVE. While in FENCING the queues remain alive
> but new requests are not allowed to be sent, and the controller cannot
> be reset, since a reset cancels inflight IOs that must be held until
> either CCR succeeds or time-based recovery completes. A new request
> issued to a controller in FENCING or FENCED is failed with a host path
> error, so a multipath request is retried on another path.
>
> FENCED is a short-lived state entered from FENCING once fencing is
> over. It is the only state from which RESETTING is reachable, so a
> manual reset cannot take effect while the controller is in FENCING.
>
> Deletion is allowed from both states. Callers of nvme_delete_ctrl()
> assume deleting a live controller cannot fail, and they cannot wait for
> the fence either. RDMA device removal and the TCP/RDMA module exit
> paths hold the transport's controller list mutex, which ->free_ctrl
> needs when the fence drops the last reference on another controller.
> Instead the transport's ->stop_ctrl flushes the fencing works, so the
> delete path waits the fence out without holding any lock.
>
> A controller deleted while fencing does not keep the fence's hold on
> its inflight requests. Once the state leaves FENCING they complete as
> in any other delete and may be retried on another path before the
> fence would have ended. This is a known limitation, to be addressed
> separately.
>
> Update nvme_available_path() to treat a controller in FENCING/FENCED
> as an available path, both states are non-terminal, add the state
> names to the sysfs state attribute and document them in
> Documentation/ABI/stable/sysfs-nvme.
For the case when the the last path is in FENCING state the new request
will be added to requeue list and will hang there until the inflight IO
has been failed by nvme_failover_req(), i.e. until RESETTING state.
That might be unexpected behavior for some applications.
fail_fast_tmo might help here, but it does not take FENCING state into
acccount in your patchset.
Could you, please, include FENCING time into fail-fast timer logic?
BR,
Dmitry
More information about the Linux-nvme
mailing list