[PATCH V10 6/8] nvme-core: check ctrl css before setting up zns

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Tue Mar 9 04:58:21 GMT 2021


In the nvme-core when setting up the ZNS in nvme_update_ns_info()
we currently don't check if ctrl supports the multi css. This can
lead to buggy controllers not having right fields set for the
multiple command sets.

Add a check by calling nvme_multi_css() in the nvme_update_ns_info()
to make sure controller support the multiple command sets.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/host/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e68a8c4ac5a6..3a372db00b9f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2217,6 +2217,13 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
 	nvme_update_disk_info(ns->disk, ns, id);
 
 	if (ns->head->ids.csi == NVME_CSI_ZNS) {
+		if (!nvme_multi_css(ns->ctrl)) {
+			dev_warn(ns->ctrl->device,
+				"Command set not reported for nsid:%d\n",
+			ns->head->ns_id);
+			ret = -EINVAL;
+			goto out_unfreeze;
+		}
 		ret = nvme_update_zone_info(ns, lbaf);
 		if (ret)
 			goto out_unfreeze;
-- 
2.22.1




More information about the Linux-nvme mailing list