From: Keith Busch <kbusch@kernel.org>
To: linux-nvme@lists.infradead.org, hch@lst.de
Cc: Keith Busch <kbusch@kernel.org>,
Max Gurtovoy <mgurtovoy@nvidia.com>,
Sagi Grimberg <sagi@grimberg.me>
Subject: [PATCH] nvme: disable namespaces with unsupported metadata
Date: Tue, 23 Nov 2021 09:45:54 -0800 [thread overview]
Message-ID: <20211123174554.3574990-1-kbusch@kernel.org> (raw)
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 <mgurtovoy@nvidia.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4b5de8f5435a..3afbf73639c3 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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 {
--
2.25.4
next reply other threads:[~2021-11-23 17:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 17:45 Keith Busch [this message]
2021-11-23 19:59 ` [PATCH] nvme: disable namespaces with unsupported metadata Sagi Grimberg
2021-11-23 21:10 ` Keith Busch
2021-11-24 9:29 ` Max Gurtovoy
2021-11-24 18:47 ` Christoph Hellwig
2021-11-24 19:57 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211123174554.3574990-1-kbusch@kernel.org \
--to=kbusch@kernel.org \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
--cc=mgurtovoy@nvidia.com \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox