From: Yang Xiuwei <yangxiuwei@kylinos.cn>
To: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, Mark Harmstone <maharmstone@fb.com>,
Yang Xiuwei <yangxiuwei@kylinos.cn>
Subject: [PATCH 3/3] btrfs: free iov when btrfs_uring_read_extent fails
Date: Wed, 5 Aug 2026 10:11:35 +0800 [thread overview]
Message-ID: <20260805021135.1896609-4-yangxiuwei@kylinos.cn> (raw)
In-Reply-To: <20260805021135.1896609-1-yangxiuwei@kylinos.cn>
After btrfs_uring_read_extent(), the caller always jumped to out_acct.
That skips kfree(data->iov), which is only correct for -EIOCBQUEUED
where the deferred path owns the iov. On failure, fall through to
out_free instead.
Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
---
fs/btrfs/ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c953e4409d5b..af5e168068d3 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4820,8 +4820,8 @@ static int btrfs_uring_encoded_read(struct io_uring_cmd *cmd, unsigned int issue
cached_state, disk_bytenr, disk_io_size,
count, data->args.compression,
data->iov, cmd);
-
- goto out_acct;
+ if (ret == -EIOCBQUEUED)
+ goto out_acct;
}
out_free:
--
2.25.1
prev parent reply other threads:[~2026-08-05 2:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 2:11 [PATCH 0/3] btrfs: fix io_uring encoded read cleanup paths Yang Xiuwei
2026-08-05 2:11 ` [PATCH 1/3] btrfs: unlock inode and extent on pages alloc failure in uring read Yang Xiuwei
2026-08-05 3:19 ` Qu Wenruo
2026-08-05 4:18 ` Yang Xiuwei
2026-08-05 2:11 ` [PATCH 2/3] btrfs: always return -EIOCBQUEUED after btrfs_uring_read_extent_endio Yang Xiuwei
2026-08-05 3:21 ` Qu Wenruo
2026-08-05 4:18 ` Yang Xiuwei
2026-08-05 2:11 ` Yang Xiuwei [this message]
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=20260805021135.1896609-4-yangxiuwei@kylinos.cn \
--to=yangxiuwei@kylinos.cn \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=maharmstone@fb.com \
/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