[PATCH v5 1/1] nvme-multipath: expose path_state via sysfs

Hannes Reinecke hare at suse.de
Mon Sep 21 02:03:17 PDT 2026


On 9/20/26 4:52 AM, 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 the
> current path state, including whether the path is enabled or disabled
> with a specific reason.
> 
> Factor the path disable checks from nvme_path_is_disabled() into a new
> nvme_path_get_state() helper that returns an enum nvme_path_state. This
> keeps the path selection logic and sysfs reporting in sync, so any future
> updates to the path disable criteria are automatically reflected in the
> sysfs output.
> 
> Possible values:
>    - "enabled"      : path is usable for I/O
>    - "ctrl-down"    : controller is not live
>    - "ana-pending"  : ANA state change pending
>    - "ns-not-ready" : namespace is not ready
> 
> This gives userspace visibility into the multipath path selection state
> without requiring users to piece together controller state and namespace
> flags manually.
> 
> Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
> ---
>   Documentation/ABI/stable/sysfs-nvme | 21 +++++++++++++
>   drivers/nvme/host/multipath.c       | 47 +++++++++++++++++++++++++----
>   drivers/nvme/host/nvme.h            |  1 +
>   drivers/nvme/host/sysfs.c           |  4 ++-
>   4 files changed, 66 insertions(+), 7 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare at kernel.org>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich



More information about the Linux-nvme mailing list