]> git.hungrycats.org Git - linux/commit
btrfs: don't stash uring encoded data across -EAGAIN
authorYang Xiuwei <yangxiuwei@kylinos.cn>
Wed, 19 Aug 2026 02:54:35 +0000 (10:54 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 17 Sep 2026 17:48:19 +0000 (19:48 +0200)
commit75df5ed2749daceace54a0b85c12c642122b1073
treebd720c250988dec099081eb7cbeeaab311369a76
parenta8031b21b1140ae6a12ca196d98f432ec1d30723
btrfs: don't stash uring encoded data across -EAGAIN

Returning -EAGAIN while leaving btrfs_uring_encoded_data in the cmd PDU
leaks if the request is cancelled or the ring exits before reissue.
io_uring does not free driver PDU allocations on cleanup.

Write: io_queue_sqe() always issues with IO_URING_F_NONBLOCK first, so
return -EAGAIN before allocating and free data on every exit.

Read: free on nowait -EAGAIN too; only -EIOCBQUEUED keeps the
allocation for btrfs_uring_read_finished().

Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
Fixes: e32dcdb0af9f ("btrfs: add io_uring interface for encoded writes")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c