* [PATCH] nvme-multipath: Early exit if no path is available
@ 2021-01-22 17:41 ` Daniel Wagner
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2021-01-22 17:41 UTC (permalink / raw)
To: linux-nvme
Cc: linux-kernel, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Daniel Wagner
nvme_round_robin_path() should test if the return ns pointer is
valid. nvme_next_ns() will return a NULL pointer if there is no path
left.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
drivers/nvme/host/multipath.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index d578de0ce3aa..8837e9da1ccf 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -239,6 +239,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
for (ns = nvme_next_ns(head, old);
ns != old;
ns = nvme_next_ns(head, ns)) {
+ if (!ns)
+ break;
if (nvme_path_is_disabled(ns))
continue;
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] nvme-multipath: Early exit if no path is available
@ 2021-01-22 17:41 ` Daniel Wagner
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2021-01-22 17:41 UTC (permalink / raw)
To: linux-nvme
Cc: Sagi Grimberg, Daniel Wagner, linux-kernel, Jens Axboe,
Keith Busch, Christoph Hellwig
nvme_round_robin_path() should test if the return ns pointer is
valid. nvme_next_ns() will return a NULL pointer if there is no path
left.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
drivers/nvme/host/multipath.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index d578de0ce3aa..8837e9da1ccf 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -239,6 +239,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
for (ns = nvme_next_ns(head, old);
ns != old;
ns = nvme_next_ns(head, ns)) {
+ if (!ns)
+ break;
if (nvme_path_is_disabled(ns))
continue;
--
2.29.2
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme-multipath: Early exit if no path is available
2021-01-22 17:41 ` Daniel Wagner
@ 2021-01-22 17:50 ` Christoph Hellwig
-1 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-01-22 17:50 UTC (permalink / raw)
To: Daniel Wagner
Cc: linux-nvme, linux-kernel, Keith Busch, Jens Axboe,
Christoph Hellwig, Sagi Grimberg
On Fri, Jan 22, 2021 at 06:41:25PM +0100, Daniel Wagner wrote:
> nvme_round_robin_path() should test if the return ns pointer is
> valid. nvme_next_ns() will return a NULL pointer if there is no path
> left.
How can that happen once we're in the loop?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme-multipath: Early exit if no path is available
@ 2021-01-22 17:50 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-01-22 17:50 UTC (permalink / raw)
To: Daniel Wagner
Cc: Sagi Grimberg, linux-kernel, linux-nvme, Jens Axboe, Keith Busch,
Christoph Hellwig
On Fri, Jan 22, 2021 at 06:41:25PM +0100, Daniel Wagner wrote:
> nvme_round_robin_path() should test if the return ns pointer is
> valid. nvme_next_ns() will return a NULL pointer if there is no path
> left.
How can that happen once we're in the loop?
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme-multipath: Early exit if no path is available
2021-01-22 17:50 ` Christoph Hellwig
@ 2021-01-22 17:55 ` Daniel Wagner
-1 siblings, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2021-01-22 17:55 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, linux-kernel, Keith Busch, Jens Axboe, Sagi Grimberg
On Fri, Jan 22, 2021 at 06:50:29PM +0100, Christoph Hellwig wrote:
> How can that happen once we're in the loop?
As far I can tell, it's the first nvme_next_ns() call which returns the
NULL pointer and this will pass the test 'ns != old'.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-22 18:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 17:41 [PATCH] nvme-multipath: Early exit if no path is available Daniel Wagner
2021-01-22 17:41 ` Daniel Wagner
2021-01-22 17:50 ` Christoph Hellwig
2021-01-22 17:50 ` Christoph Hellwig
2021-01-22 17:55 ` Daniel Wagner
2021-01-22 17:55 ` Daniel Wagner
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.