* [PATCH] nvme-multipath: clear NVME_NS_SYSFS_ATTR_LINK when disk is not added
@ 2025-04-14 12:25 Hannes Reinecke
2025-04-14 20:32 ` Sagi Grimberg
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2025-04-14 12:25 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke,
Nilay Shroff
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@kernel.org>
Cc: Nilay Shroff <nilay@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);
/*
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-multipath: clear NVME_NS_SYSFS_ATTR_LINK when disk is not added
2025-04-14 12:25 [PATCH] nvme-multipath: clear NVME_NS_SYSFS_ATTR_LINK when disk is not added Hannes Reinecke
@ 2025-04-14 20:32 ` Sagi Grimberg
2025-04-15 6:06 ` Nilay Shroff
0 siblings, 1 reply; 3+ messages in thread
From: Sagi Grimberg @ 2025-04-14 20:32 UTC (permalink / raw)
To: Hannes Reinecke, Christoph Hellwig; +Cc: Keith Busch, linux-nvme, Nilay Shroff
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@kernel.org>
> Cc: Nilay Shroff <nilay@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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-multipath: clear NVME_NS_SYSFS_ATTR_LINK when disk is not added
2025-04-14 20:32 ` Sagi Grimberg
@ 2025-04-15 6:06 ` Nilay Shroff
0 siblings, 0 replies; 3+ messages in thread
From: Nilay Shroff @ 2025-04-15 6:06 UTC (permalink / raw)
To: Sagi Grimberg, Hannes Reinecke, Christoph Hellwig; +Cc: Keith Busch, linux-nvme
On 4/15/25 2:02 AM, Sagi Grimberg wrote:
>
>
> 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@kernel.org>
>> Cc: Nilay Shroff <nilay@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?
This is exactly same issue I also encountered last week while unit testing
changes while adding support for this feature in libnvme. Then I fixed it
locally and queued it up for upstream. But anyways, I'm glad that you already
fixed it and send the fix upstream :)
However my changes were exactly same as Sagi suggested. I just changed the
order of setting NVME_NS_SYSFS_ATTR_LINK and GD_ADDED. So I also recommend
we may just switch the order and fix it.
Thanks,
--Nilay
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-15 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 12:25 [PATCH] nvme-multipath: clear NVME_NS_SYSFS_ATTR_LINK when disk is not added Hannes Reinecke
2025-04-14 20:32 ` Sagi Grimberg
2025-04-15 6:06 ` Nilay Shroff
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.