public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring/dma-buf: don't fail fixed buffers without dma-buf support
@ 2026-10-22 13:20 Anuj Gupta
  2026-10-22 15:27 ` Jens Axboe
  2026-10-23 17:48 ` Pavel Begunkov
  0 siblings, 2 replies; 3+ messages in thread
From: Anuj Gupta @ 2026-10-22 13:20 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov, Christoph Hellwig; +Cc: io-uring, Anuj Gupta

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

io_attach_dmabuf_map() is called for every fixed read/write, but returns
-EOPNOTSUPP when CONFIG_DMA_SHARED_BUFFER is disabled before checking
whether the request uses a dma-buf at all. So READ_FIXED and WRITE_FIXED
fail for ordinary registered buffers. Check REQ_F_DMABUF first.

Fixes: 62e4bf5b25d4 ("io_uring/rsrc: add dmabuf backed registered buffers")
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
 io_uring/dma-buf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_uring/dma-buf.h b/io_uring/dma-buf.h
index a876a9e5e272..534c06b6879f 100644
--- a/io_uring/dma-buf.h
+++ b/io_uring/dma-buf.h
@@ -34,10 +34,10 @@ static inline int io_attach_dmabuf_map(struct io_kiocb *req,
 	struct dma_buf_io_map *map;
 	struct io_buf_dma *bd;
 
-	if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
-		return -EOPNOTSUPP;
 	if (!(req->flags & REQ_F_DMABUF))
 		return 0;
+	if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+		return -EOPNOTSUPP;
 
 	bd = req->buf_node->buf->priv;
 	map = dma_buf_io_get_map(bd->ctx, nowait);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] io_uring/dma-buf: don't fail fixed buffers without dma-buf support
  2026-10-22 13:20 [PATCH] io_uring/dma-buf: don't fail fixed buffers without dma-buf support Anuj Gupta
@ 2026-10-22 15:27 ` Jens Axboe
  2026-10-23 17:48 ` Pavel Begunkov
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2026-10-22 15:27 UTC (permalink / raw)
  To: Pavel Begunkov, Christoph Hellwig, Anuj Gupta; +Cc: io-uring, Anuj Gupta


On Thu, 22 Oct 2026 18:50:27 +0530, Anuj Gupta wrote:
> io_attach_dmabuf_map() is called for every fixed read/write, but returns
> -EOPNOTSUPP when CONFIG_DMA_SHARED_BUFFER is disabled before checking
> whether the request uses a dma-buf at all. So READ_FIXED and WRITE_FIXED
> fail for ordinary registered buffers. Check REQ_F_DMABUF first.

Applied, thanks!

[1/1] io_uring/dma-buf: don't fail fixed buffers without dma-buf support
      commit: 45b716456dd99488a0cef58482120dc0474aa696

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] io_uring/dma-buf: don't fail fixed buffers without dma-buf support
  2026-10-22 13:20 [PATCH] io_uring/dma-buf: don't fail fixed buffers without dma-buf support Anuj Gupta
  2026-10-22 15:27 ` Jens Axboe
@ 2026-10-23 17:48 ` Pavel Begunkov
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Begunkov @ 2026-10-23 17:48 UTC (permalink / raw)
  To: Anuj Gupta, Jens Axboe, Christoph Hellwig; +Cc: io-uring, Anuj Gupta

On 10/22/26 14:20, Anuj Gupta wrote:
> From: Anuj Gupta <anuj20.g@samsung.com>
> 
> io_attach_dmabuf_map() is called for every fixed read/write, but returns
> -EOPNOTSUPP when CONFIG_DMA_SHARED_BUFFER is disabled before checking
> whether the request uses a dma-buf at all. So READ_FIXED and WRITE_FIXED
> fail for ordinary registered buffers. Check REQ_F_DMABUF first.
> 
> Fixes: 62e4bf5b25d4 ("io_uring/rsrc: add dmabuf backed registered buffers")
> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
> ---
>   io_uring/dma-buf.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/io_uring/dma-buf.h b/io_uring/dma-buf.h
> index a876a9e5e272..534c06b6879f 100644
> --- a/io_uring/dma-buf.h
> +++ b/io_uring/dma-buf.h
> @@ -34,10 +34,10 @@ static inline int io_attach_dmabuf_map(struct io_kiocb *req,
>   	struct dma_buf_io_map *map;
>   	struct io_buf_dma *bd;
>   
> -	if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
> -		return -EOPNOTSUPP;

Good catch. It was supposed to be

if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
	return 0;

as there shouldn't be any dma-buf registered buffers
when it's disabled. Looks good in either case

-- 
Pavel Begunkov


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-23 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22 13:20 [PATCH] io_uring/dma-buf: don't fail fixed buffers without dma-buf support Anuj Gupta
2026-10-22 15:27 ` Jens Axboe
2026-10-23 17:48 ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox