Linux io-uring development
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Diangang Li <diangangli@gmail.com>, axboe@kernel.dk
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
	Diangang Li <lidiangang@bytedance.com>
Subject: Re: [PATCH 1/2] io_uring/dma-buf: release the I/O context before the target file
Date: Thu, 3 Dec 2026 12:10:17 +0000	[thread overview]
Message-ID: <fe5fc41e-60e0-4d3c-96c7-ff01151123ad@gmail.com> (raw)
In-Reply-To: <20261130072837.4191677-1-diangangli@gmail.com>

On 11/30/26 07:28, Diangang Li wrote:
> From: Diangang Li <lidiangang@bytedance.com>
> 
> io_release_dmabuf() drops the target file before destroying the I/O
> context. If the final file release runs via delayed_fput_work, it can
> drop the importer's module reference before the ->unmap() and ->release()
> callbacks have completed.

Looks good. There is a discussion for 2/2, but I'd merge this
one first.

Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>

> Release the context first so the target file pins the module throughout
> teardown.
> 
> Fixes: 62e4bf5b25d4 ("io_uring/rsrc: add dmabuf backed registered buffers")
> Assisted-by: LLM
> Signed-off-by: Diangang Li <lidiangang@bytedance.com>
> ---
>   io_uring/dma-buf.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/io_uring/dma-buf.c b/io_uring/dma-buf.c
> index 61825d59e384..255767cdb1ca 100644
> --- a/io_uring/dma-buf.c
> +++ b/io_uring/dma-buf.c
> @@ -4,8 +4,9 @@ static inline void io_release_dmabuf(void *priv)
>   {
>   	struct io_buf_dma *bd = priv;
>   
> -	fput(bd->target_file);
> +	/* the open target file keeps the importer's module loaded */
>   	dma_buf_io_ctx_release(bd->ctx);
> +	fput(bd->target_file);
>   	kfree(bd);
>   }
>   

-- 
Pavel Begunkov


  parent reply	other threads:[~2026-12-03 12:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  7:28 [PATCH 1/2] io_uring/dma-buf: release the I/O context before the target file Diangang Li
2026-11-30  7:28 ` [PATCH 2/2] io_uring/rw: honour RWF_NOWAIT when a dma-buf map is missing Diangang Li
2026-12-03  8:28   ` Anuj Gupta
2026-12-03 15:07   ` Pavel Begunkov
2026-12-04  2:35     ` Diangang Li
2026-12-03 12:10 ` Pavel Begunkov [this message]
2026-12-03 12:53 ` [PATCH 1/2] io_uring/dma-buf: release the I/O context before the target file Anuj gupta

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=fe5fc41e-60e0-4d3c-96c7-ff01151123ad@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=diangangli@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=lidiangang@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    /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