Re: [PATCH] nvme: reject zoned namespaces whose zone info query failed

From: Keith Busch

Date: Fri Aug 14 2026 - 15:28:58 EST


On Fri, Aug 14, 2026 at 12:09:54PM -0400, Chao Shi wrote:
> Before commit c85c9ab926a5 ("nvme: split nvme_update_zone_info") the
> caller tested "if (ret)" and bailed out on any non-zero return. Restore
> that behaviour.

I think the namespace is generally left up on purpose for controller
reported errors so that we have a device handle for admin debugging
purposes.

Can you just skip the zone limits update when you have a bad response?
Something like:

--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2457,7 +2457,8 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
capacity = 0;

if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
- ns->head->ids.csi == NVME_CSI_ZNS)
+ ns->head->ids.csi == NVME_CSI_ZNS &&
+ zi.max_open_zones)
nvme_update_zone_info(ns, &lim, &zi);

if ((ns->ctrl->vwc & NVME_CTRL_VWC_PRESENT) && !info->no_vwc)