[PATCH] nvme: return -EOPNOTSUPP for unsupported dma-buf I/O

Anuj Gupta anuj1072538 at gmail.com
Fri Oct 30 05:03:00 PDT 2026


From: Anuj Gupta <anuj20.g at samsung.com>

dma_buf_io_ctx_create() uses -EOPNOTSUPP when a file cannot create a
dma-buf I/O context. NVMe currently returns -EINVAL when the namespace's
transport does not implement ->init_dma_buf_io_ctx, making fabrics
namespaces report an invalid argument for an unsupported operation.

Return -EOPNOTSUPP instead.

Fixes: ce5e386c1108 ("nvme-pci: implement dma-buf backed requests")
Signed-off-by: Anuj Gupta <anuj20.g at samsung.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a7a4d09644c1..54d4888cdcd1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2720,7 +2720,7 @@ static int nvme_init_dma_buf_io_ctx(struct block_device *bdev,
 	struct nvme_ctrl *ctrl = ns->ctrl;
 
 	if (!ctrl->ops->init_dma_buf_io_ctx)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 	return ctrl->ops->init_dma_buf_io_ctx(ctrl, ctx);
 }
 

base-commit: 70866cfa169d5ee149364267289e71d50f9a7ae9
-- 
2.43.0




More information about the Linux-nvme mailing list