[PATCH] nvme-multipath: clear NVME_NS_SYSFS_ATTR_LINK when disk is not added
Sagi Grimberg
sagi at grimberg.me
Mon Apr 14 13:32:43 PDT 2025
On 14/04/2025 15:25, Hannes Reinecke wrote:
> If the namespace disk is not added we need to clear NVME_NS_SYSFS_ATTR_LINK,
> otherwise the link will never be created upon rescan.
>
> Fixes: 4dbd2b2ebe4c ("nvme-multipath: Add visibility for round-robin io-policy")
>
> Signed-off-by: Hannes Reinecke <hare at kernel.org>
> Cc: Nilay Shroff <nilay at linux.ibm.com>
> ---
> drivers/nvme/host/multipath.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 05eccd96d34a..5c28f0dc6fad 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -1069,8 +1069,10 @@ void nvme_mpath_add_sysfs_link(struct nvme_ns_head *head)
> * Ensure that ns path disk node is already added otherwise we
> * may get invalid kobj name for target
> */
> - if (!test_bit(GD_ADDED, &ns->disk->state))
> + if (!test_bit(GD_ADDED, &ns->disk->state)) {
> + clear_bit(NVME_NS_SYSFS_ATTR_LINK, &ns->flags);
> continue;
> + }
>
> target = disk_to_dev(ns->disk);
> /*
Why not change the ordering of GD_ADDED and NVME_NS_SYSFS_ATTR_LINK checks?
More information about the Linux-nvme
mailing list