[PATCH] nvme-multipath: expose path_state via sysfs
Guixin Liu
kanie at linux.alibaba.com
Sun Jun 21 19:02:48 PDT 2026
在 2026/6/18 21:02, Daniel Wagner 写道:
> On Wed, Jun 17, 2026 at 08:15:43PM +0800, Guixin Liu wrote:
>> Add a read-only "path_state" sysfs attribute to each NVMe path namespace
>> device (/sys/class/nvme/nvmeX/nvmeXcYnZ/path_state) that exposes whether
>> the path is currently enabled or disabled.
>>
>> The attribute reflects the result of nvme_path_is_disabled(), showing
>> "disabled" when the controller is not live/deleting, the namespace has
>> an ANA state change pending, or the namespace is not ready. Otherwise
>> it shows "enabled".
>>
>> This gives userspace visibility into the multipath path selection state
>> without requiring users to piece together controller state and namespace
>> flags manually.
> The ctrl state is already exposed to the sysfs. What's the use case for
> this sysfs entry?
1. A controller being live only indicates that the transport connection
is healthy.
However, due to ANA, a path through that controller may be inaccessible
or non-optimized.
The ctrl state simply cannot express this.
2. Different namespaces on the same controller can belong to different
ANA groups
with different access states. For example, ns1 may be optimized while ns2 is
inaccessible on the same controller. A single ctrl state value cannot
represent this granularity.
3. The multipath iopolicy (numa, round-robin, queue-depth, service-time)
makes
routing decisions based on path state. Without visibility into path
state, users
cannot understand or predict why I/O is routed to a particular path,
making performance debugging a black box.
4. For monitoring and diagnosis, When I/O latency spikes in production,
operators need
to determine within seconds: Did an ANA failover occur? Which path
became inaccessible? Is a non-optimized
path now carrying traffic? The ctrl state just shows live and cannot
answer any of these questions.
Best Regards,
Guixin Liu
More information about the Linux-nvme
mailing list