[PATCH] nvme: allow ioctl to submit io command with dif for NVMeoF

Chao Leng lengchao at huawei.com
Wed Aug 3 02:44:36 PDT 2022


If nvme over fabrics support t10dif, NVME_NS_EXT_LBAS and
NVME_NS_METADATA_SUPPORTED of ns->features will be set to 1.
Now nvme_submit_io do not allow the metadata if NVME_NS_EXT_LBAS of
ns->features is setted. Indeed It should allow the metadata if both
NVME_NS_EXT_LBAS and NVME_NS_METADATA_SUPPORTED of ns->features are setted.

Signed-off-by: Chao Leng <lengchao at huawei.com>
---
 drivers/nvme/host/ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index a2e89db1cd63..408ba0cc111f 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -199,7 +199,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
 		metadata = nvme_to_user_ptr(io.metadata);
 	}
 
-	if (ns->features & NVME_NS_EXT_LBAS) {
+	if ((ns->features & (NVME_NS_EXT_LBAS | NVME_NS_METADATA_SUPPORTED)) ==
+		NVME_NS_EXT_LBAS) {
 		length += meta_len;
 		meta_len = 0;
 	} else if (meta_len) {
-- 
2.16.4




More information about the Linux-nvme mailing list