nvme: don't return an error from nvme_configure_metadata
Christoph Hellwig
maintainerPATCH 1/2 nvme: don't return an error from nvme_configure_metadata
When a fabrics controller claims to support an invalidate metadata configuration we already warn and disable metadata support. No need to also return an error during revalidation.
--- drivers/nvme/host/core.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/nvme/host/core.c +5 -8
@@ -1723,7 +1723,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns,return 0 ; } -static int nvme_configure_metadata (struct nvme_ns *ns,struct nvme_id_ns *id) +static void nvme_configure_metadata (struct nvme_ns *ns,struct nvme_id_ns *id) {struct nvme_ctrl *ctrl = ns->ctrl;
@@ -1739,7 +1739,8 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) ns->features &= ~(NVME_NS_METADATA_SUPPORTED |NVME_NS_EXT_LBAS );if (!ns->ms || !(ctrl->ops->flags &NVME_F_METADATA_SUPPORTED )) -return 0 ; +return ; +if (ctrl->ops->flags &NVME_F_FABRICS ) {/* * The NVMe over Fabrics specification only supports metadata as
@@ -1747,7 +1748,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)* remap the separate metadata buffer from the block layer. */ if (WARN_ON_ONCE (!(id->flbas &NVME_NS_FLBAS_META_EXT ))) -return -EINVAL ; +return ; ns->features |=NVME_NS_EXT_LBAS ;
@@ -1774,8 +1775,6 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)else ns->features |=NVME_NS_METADATA_SUPPORTED ; } - -return 0 ; } static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
@@ -1916,9 +1915,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) ns->lba_shift = id->lbaf[lbaf].ds;nvme_set_queue_limits (ns->ctrl, ns->queue); - ret =nvme_configure_metadata (ns, id); -if (ret) - goto out_unfreeze; +nvme_configure_metadata (ns, id);nvme_set_chunk_sectors (ns, id);nvme_update_disk_info (ns->disk, ns, id);
Signature · 1 line
2.30.2
Christoph Hellwig
maintainerPATCH 2/2 nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info
Commit e7d65803e2bb ("nvme-multipath: revalidate paths during rescan") introduced the NVME_NS_READY flag, which nvme_path_is_disabled() uses to check if a path can be used or not. We also need to set this flag for devices that fail the ZNS feature validation and which are available through passthrough devices only to that they can be used in multipathing setups.
--- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +3 -3
@@ -1931,7 +1931,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)if (blk_queue_is_zoned (ns->queue)) { ret =nvme_revalidate_zones (ns);if (ret && !nvme_first_scan (ns->disk)) - goto out; +return ret; }if (nvme_ns_head_multipath (ns->head)) {
@@ -1946,16 +1946,16 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)return 0 ; out_unfreeze: -blk_mq_unfreeze_queue (ns->disk->queue); -out:/* * If probing fails due an unsupported feature, hide the block device, * but still allow other access. */ if (ret == -ENODEV ) { ns->disk->flags |=GENHD_FL_HIDDEN ; +set_bit (NVME_NS_READY , &ns->flags); ret =0 ; } +blk_mq_unfreeze_queue (ns->disk->queue);return ret; }
Signature · 1 line
2.30.2
Re: [PATCH 2/2] nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info
Quoted 8 lines · Christoph Hellwig
Commit
e7d65803e2bb("nvme-multipath: revalidate paths during rescan") introduced theNVME_NS_READYflag, whichnvme_path_is_disabled()uses to check if a path can be used or not. We also need to set this flag for devices that fail the ZNS feature validation and which are available through passthrough devices only to that they can be used in multipathing setups.
Quoted 4 lines
Fixes e7d65803e2bb ("nvme-multipath: revalidate paths during rescan")Reported-by Kanchan Joshi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>---
Looks good and works fine.
Signature · 1 line
Kanchan
Re: [PATCH 2/2] nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info
In reply to Christoph Hellwigdrivers/nvme/host/core.c static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · line 1958
Quoted 13 lines · Christoph Hellwig
out_unfreeze:drivers/nvme/host/core.c +2
-2-blk_mq_unfreeze_queue (ns->disk->queue); -out:/* * If probing fails due an unsupported feature, hide the block device, * but still allow other access. */ if (ret == -ENODEV ) { ns->disk->flags |=GENHD_FL_HIDDEN ; +set_bit (NVME_NS_READY , &ns->flags); ret =0 ; } +blk_mq_unfreeze_queue (ns->disk->queue);
Do you want to unfreeze the queue also for non ENODEV errors? It seems ENOMEM is possible.
Christoph Hellwig
maintainerRe: [PATCH 2/2] nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info
Quoted 17 lines · Daniel Wagner
drivers/nvme/host/core.c static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · line 1958
Quoted 13 lines · Christoph Hellwig
out_unfreeze:drivers/nvme/host/core.c +2
-2-blk_mq_unfreeze_queue (ns->disk->queue); -out:/* * If probing fails due an unsupported feature, hide the block device, * but still allow other access. */ if (ret == -ENODEV ) { ns->disk->flags |=GENHD_FL_HIDDEN ; +set_bit (NVME_NS_READY , &ns->flags); ret =0 ; } +blk_mq_unfreeze_queue (ns->disk->queue);Do you want to unfreeze the queue also for non ENODEV errors? It seems ENOMEM is possible.
We always want to unfreeze it, just as before. The unfreeze just moves after the place where we set NVME_NS_READY.
Daniel Wagner
Reviewed-byRe: [PATCH 2/2] nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info
Quoted 2 lines · Christoph Hellwig
We always want to unfreeze it, just as before. The unfreeze just moves after the place where we set
NVME_NS_READY.
Ah, thanks for explaining.
Re: [PATCH 2/2] nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info
In reply to Christoph HellwigQuoted 6 lines · Christoph Hellwig
When a fabrics controller claims to support an invalidate metadata configuration we already warn and disable metadata support. No need to also return an error during revalidation.
Signed-off-by Christoph Hellwig <[email protected]>
LGTM.
Signature · 1 line
Kanchan
Quoted 5 lines · Christoph Hellwig
When a fabrics controller claims to support an invalidate metadata configuration we already warn and disable metadata support. No need to also return an error during revalidation.
Signed-off-by Christoph Hellwig <[email protected]>