[PATCH V4 0/9] nvmet: add ZBD backend support

Chaitanya Kulkarni Chaitanya.Kulkarni at wdc.com
Wed Dec 9 22:07:32 EST 2020


On 12/2/20 01:20, Christoph Hellwig wrote:
> Unless I'm missing something this fails to advertise multiple command
> support in the CAP property, as well as the enablement in the CC
> property.  How does the host manage to even use this?
>
Yes, it is because host side doesn't check for the controller cap
property it
only checks for the ns->head->ids.csi == NVME_CSI_ZNS that is set from the
ns-desclist call, so this series got awaywithout cap/cc and CSI target side
support.

I think something like following (totally untested) will help to avoid the
scenarios like this for ZNS drives so we can rejects the buggy controllers
early to make sure we are spec compliant :-

# git diff# git diff
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d9b152bae19d..7b196299c9b7 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2166,6 +2166,11 @@ static int nvme_update_ns_info(struct nvme_ns
*ns, struct nvme_id_ns *id)
        nvme_set_queue_limits(ns->ctrl, ns->queue);
 
        if (ns->head->ids.csi == NVME_CSI_ZNS) {
+               if (!(NVME_CAP_CSS(ns->ctrl->cap) & NVME_CAP_CSS_CSI)) {
+                       pr_err("zns ns found with ctrl support for CSI");
+                       goto out_unfreeze;
+               }
+
                ret = nvme_update_zone_info(ns, lbaf);
                if (ret)
                        goto out_unfreeze;





More information about the Linux-nvme mailing list