public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Sidong Yang <[email protected]>,
	Jens Axboe <[email protected]>, Josef Bacik <[email protected]>,
	David Sterba <[email protected]>
Cc: [email protected], [email protected],
	[email protected]
Subject: Re: [RFC PATCH 2/2] btrfs: ioctl: use registered buffer for IORING_URING_CMD_FIXED
Date: Tue, 11 Mar 2025 12:55:48 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 3/11/25 11:40, Sidong Yang wrote:
> This patch supports IORING_URING_CMD_FIXED flags in io-uring cmd. It
> means that user provided buf_index in sqe that is registered before
> submitting requests. In this patch, btrfs_uring_encoded_read() makes
> iov_iter bvec type by checking the io-uring cmd flag. And there is
> additional iou_vec field in btrfs_uring_priv for remaining bvecs
> lifecycle.
> 
> Signed-off-by: Sidong Yang <[email protected]>
> ---
>   fs/btrfs/ioctl.c | 26 +++++++++++++++++++++-----
>   1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 6c18bad53cd3..586671eea622 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -4643,6 +4643,7 @@ struct btrfs_uring_priv {
>   	struct page **pages;
>   	unsigned long nr_pages;
>   	struct kiocb iocb;
> +	struct iou_vec iou_vec;

This structure should not be leaked out of core io_uring ...

>   	struct iovec *iov;
>   	struct iov_iter iter;
>   	struct extent_state *cached_state;
> @@ -4711,6 +4712,8 @@ static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int iss
>   
>   	kfree(priv->pages);
>   	kfree(priv->iov);
> +	if (priv->iou_vec.iovec)
> +		kfree(priv->iou_vec.iovec);

... exactly because if this. This line relies on details it
shouldn't.

-- 
Pavel Begunkov


  reply	other threads:[~2025-03-11 12:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 11:40 [RFC PATCH 0/2] introduce io_uring_cmd_import_fixed_vec Sidong Yang
2025-03-11 11:40 ` [RFC PATCH 1/2] io_uring: cmd: " Sidong Yang
2025-03-11 13:08   ` Pavel Begunkov
2025-03-12  3:08     ` Sidong Yang
2025-03-11 11:40 ` [RFC PATCH 2/2] btrfs: ioctl: use registered buffer for IORING_URING_CMD_FIXED Sidong Yang
2025-03-11 12:55   ` Pavel Begunkov [this message]
2025-03-12  3:05     ` Sidong Yang

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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