public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-multipath: drop head pointer check in nvme_mpath_clear_current_path()
@ 2026-04-08  8:03 John Garry
  2026-04-09  6:11 ` Christoph Hellwig
  2026-04-09 14:21 ` Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: John Garry @ 2026-04-08  8:03 UTC (permalink / raw)
  To: hch, kbusch, sagi, axboe; +Cc: linux-nvme, John Garry

A NS will always have a head pointer, so drop the check. As proof in
practice, all the nvme_mpath_clear_current_path() callers also
dereference ns->head.

This check has endured since the original changes to support multipath.

Signed-off-by: John Garry <john.g.garry@oracle.com>

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index ba00f0b72b858..263161cb8ac06 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -231,16 +231,12 @@ bool nvme_mpath_clear_current_path(struct nvme_ns *ns)
 	bool changed = false;
 	int node;
 
-	if (!head)
-		goto out;
-
 	for_each_node(node) {
 		if (ns == rcu_access_pointer(head->current_path[node])) {
 			rcu_assign_pointer(head->current_path[node], NULL);
 			changed = true;
 		}
 	}
-out:
 	return changed;
 }
 
-- 
2.43.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvme-multipath: drop head pointer check in nvme_mpath_clear_current_path()
  2026-04-08  8:03 [PATCH] nvme-multipath: drop head pointer check in nvme_mpath_clear_current_path() John Garry
@ 2026-04-09  6:11 ` Christoph Hellwig
  2026-04-09 14:21 ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-04-09  6:11 UTC (permalink / raw)
  To: John Garry; +Cc: hch, kbusch, sagi, axboe, linux-nvme

On Wed, Apr 08, 2026 at 08:03:57AM +0000, John Garry wrote:
> A NS will always have a head pointer, so drop the check. As proof in
> practice, all the nvme_mpath_clear_current_path() callers also
> dereference ns->head.
> 
> This check has endured since the original changes to support multipath.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvme-multipath: drop head pointer check in nvme_mpath_clear_current_path()
  2026-04-08  8:03 [PATCH] nvme-multipath: drop head pointer check in nvme_mpath_clear_current_path() John Garry
  2026-04-09  6:11 ` Christoph Hellwig
@ 2026-04-09 14:21 ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2026-04-09 14:21 UTC (permalink / raw)
  To: John Garry; +Cc: hch, sagi, axboe, linux-nvme

On Wed, Apr 08, 2026 at 08:03:57AM +0000, John Garry wrote:
> A NS will always have a head pointer, so drop the check. As proof in
> practice, all the nvme_mpath_clear_current_path() callers also
> dereference ns->head.
> 
> This check has endured since the original changes to support multipath.

Thanks, applied to nvme-7.1.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-09 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08  8:03 [PATCH] nvme-multipath: drop head pointer check in nvme_mpath_clear_current_path() John Garry
2026-04-09  6:11 ` Christoph Hellwig
2026-04-09 14:21 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox