All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: verify MNAN value if ANA is enabled
@ 2021-05-31 10:36 ` Daniel Wagner
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Wagner @ 2021-05-31 10:36 UTC (permalink / raw)
  To: linux-nvme
  Cc: linux-kernel, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Daniel Wagner

The controller is required to have a non-zero MNAN value if it supports
ANA:

   If the controller supports Asymmetric Namespace Access Reporting, then
   this field shall be set to a non-zero value that is less than or equal
   to the NN value.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
This is a follow up to the discussion in

  https://lore.kernel.org/linux-nvme/20210521144734.90044-1-dwagner@suse.de/

 drivers/nvme/host/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index cb1a76a3d42a..4c412adc9e14 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2972,6 +2972,16 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 	if (ret < 0)
 		goto out_free;
 
+#ifdef CONFIG_NVME_MULTIPATH
+	if (ctrl->ana_log_buf && (!ctrl->max_namespaces ||
+				  ctrl->max_namespaces > le32_to_cpu(id->nn))) {
+		dev_err(ctrl->device,
+			"Invalid MNAN value %u\n", ctrl->max_namespaces);
+		ret = -EINVAL;
+		goto out_free;
+	}
+#endif
+
 	if (ctrl->apst_enabled && !prev_apst_enabled)
 		dev_pm_qos_expose_latency_tolerance(ctrl->device);
 	else if (!ctrl->apst_enabled && prev_apst_enabled)
-- 
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] 8+ messages in thread

end of thread, other threads:[~2021-06-03  7:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-31 10:36 [PATCH] nvme: verify MNAN value if ANA is enabled Daniel Wagner
2021-05-31 10:36 ` Daniel Wagner
2021-05-31 15:25 ` Hannes Reinecke
2021-05-31 15:25   ` Hannes Reinecke
2021-06-01 17:28 ` Chaitanya Kulkarni
2021-06-01 17:28   ` Chaitanya Kulkarni
2021-06-03  7:16 ` Christoph Hellwig
2021-06-03  7:16   ` Christoph Hellwig

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.