Skip to contentSkip to conversation

nvme: disable namespaces with unsupported metadata

PATCH Superseded Keith Busch 4 participants 6 messages Nov 23, 2021 – Nov 24, 2021 NVMe

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Keith Busch

author maintainer
#0 lore raw

PATCH 1/1 nvme: disable namespaces with unsupported metadata

The only fabrics target that supports metadata is RDMA and usable only if it is 8B per block, and formatted for protection information. If an rdma target were to export a namespace with a different format (ex:
4k+64B), the driver will not be able to submit a valid command for that format.

Suppress exporting these namespaces as read/writeable to the block stack.

Cc Max Gurtovoy <[email protected]>
Cc Sagi Grimberg <[email protected]>
---
 drivers/nvme/host/core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +10 -1
index 4b5de8f5435a..3afbf73639c3 100644
@@ -1740,7 +1740,16 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
 		 */
 		if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT)))
 			return -EINVAL;
-		if (ctrl->max_integrity_segments)
+
+		/*
+		 * Currently rdma is the only fabrics nvme host that supports
+		 * metadata integrity segments, but will not use the metadata
+		 * payload if it doesn't satisfy 'nvme_ns_has_pi()'. Since the
+		 * initiator is not able to form requests that satisify the
+		 * format, do not support the namespace if the metadata does
+		 * not satisfy that requirement.
+		 */
+		if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns))
 			ns->features |=
 				(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
 	} else {
Signature · 1 line
2.25.4
author maintainer
#2 lore raw
In reply to Keith Busch
Quoted 1 line · Keith Busch

The only fabrics target that supports metadata is RDMA and usable only

Sorry, the above should have said:

"The only fabrics host driver that currently supports metadata is ..."

I believe the spec allows all transports to support any arbitrary metadata format. The drivers just currently aren't able to, and we can update this path as they become more capable.

Quoted 7 lines

if it is 8B per block, and formatted for protection information. If an rdma target were to export a namespace with a different format (ex:
4k+64B), the driver will not be able to submit a valid command for that format.

Suppress exporting these namespaces as read/writeable to the block stack.

Reviewed-by
#3 lore raw
Quoted 17 lines · Keith Busch
Quoted 1 line · Keith Busch

The only fabrics target that supports metadata is RDMA and usable only

Sorry, the above should have said:

"The only fabrics host driver that currently supports metadata is ..."

I believe the spec allows all transports to support any arbitrary metadata format. The drivers just currently aren't able to, and we can update this path as they become more capable.

Quoted 7 lines

if it is 8B per block, and formatted for protection information. If an rdma target were to export a namespace with a different format (ex:
4k+64B), the driver will not be able to submit a valid command for that format.

Suppress exporting these namespaces as read/writeable to the block stack.

Looks good,

#4 lore raw
In reply to Keith Busch
Quoted 8 lines · Keith Busch

The only fabrics target that supports metadata is RDMA and usable only if it is 8B per block, and formatted for protection information. If an rdma target were to export a namespace with a different format (ex:
4k+64B), the driver will not be able to submit a valid command for that format.

Suppress exporting these namespaces as read/writeable to the block stack.

Where do we disable the namepsace? We only do not set the metadata supported flag here, don't we?

drivers/nvme/host/core.c static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)

Quoted 4 lines
drivers/nvme/host/core.c +4 -0
+		/*
+		 * Currently rdma is the only fabrics nvme host that supports
+		 * metadata integrity segments, but will not use the metadata
+		 * payload if it doesn't satisfy 'nvme_ns_has_pi()'.

s/fabric nvme host/transport/

drivers/nvme/host/core.c static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · line 1751

Quoted 5 lines

Since the

drivers/nvme/host/core.c +4 -0
+		 * initiator is not able to form requests that satisify the
+		 * format, do not support the namespace if the metadata does
+		 * not satisfy that requirement.
+		 */

I can't really parse this sentence. Also initiator doesn't make much sense in a NVMe context.

author maintainer
#5 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Keith Busch

The only fabrics target that supports metadata is RDMA and usable only if it is 8B per block, and formatted for protection information. If an rdma target were to export a namespace with a different format (ex:
4k+64B), the driver will not be able to submit a valid command for that format.

Quoted 5 lines
Quoted 2 lines

Suppress exporting these namespaces as read/writeable to the block stack.

Where do we disable the namepsace? We only do not set the metadata supported flag here, don't we?

Without the flag set, a namespace with metadata gets to be 0 capacity. That will make it unusable through the block stack r/w path, at least.

Quoted 7 lines

drivers/nvme/host/core.c static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)

Quoted 4 lines
drivers/nvme/host/core.c +4 -0
+		/*
+		 * Currently rdma is the only fabrics nvme host that supports
+		 * metadata integrity segments, but will not use the metadata
+		 * payload if it doesn't satisfy 'nvme_ns_has_pi()'.

s/fabric nvme host/transport/

Quoted 8 lines

drivers/nvme/host/core.c static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · line 1751

Quoted 5 lines

Since the

drivers/nvme/host/core.c +4 -0
+		 * initiator is not able to form requests that satisify the
+		 * format, do not support the namespace if the metadata does
+		 * not satisfy that requirement.
+		 */

I can't really parse this sentence. Also initiator doesn't make much sense in a NVMe context.

I'll reword this.