Re: [PATCH 2/3] btrfs: always return -EIOCBQUEUED after btrfs_uring_read_extent_endio

Qu Wenruo <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>

在 2026/8/5 11:41, Yang Xiuwei 写道:
> If all bios finish before btrfs_encoded_read_regular_fill_pages()
> returns, it calls btrfs_uring_read_extent_endio() and previously
> returned the I/O status.  A negative errno then made
> btrfs_uring_read_extent() unlock and free while
> btrfs_uring_read_finished() did the same again.
> 
> Return -EIOCBQUEUED so only the deferred path cleans up.
> 
> Reported-by: Yue Sun <[email protected]>
> Closes: https://lore.kernel.org/linux-btrfs/[email protected]/
> Suggested-by: Jens Axboe <[email protected]>
> Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
> Signed-off-by: Yang Xiuwei <[email protected]>

Sashiko is reporting errors on pre-existing problems for this and the 
next patch:

https://sashiko.dev/#/patchset/20260805021135.1896609-1-yangxiuwei%40kylinos.cn

I believe they are worth addressing since you're touching the error 
handling.


> ---
>   fs/btrfs/inode.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index b446c3014b24..8e3cee3845e6 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -9411,7 +9411,6 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
>   	struct completion sync_reads;
>   	unsigned long i = 0;
>   	struct btrfs_bio *bbio;
> -	int ret;
>   
>   	/*
>   	 * Fast path for synchronous reads which completes in this call, io_uring
> @@ -9458,10 +9457,10 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
>   
>   	if (uring_ctx) {
>   		if (refcount_dec_and_test(&priv->pending_refs)) {
> -			ret = blk_status_to_errno(READ_ONCE(priv->status));
> -			btrfs_uring_read_extent_endio(uring_ctx, ret);
> +			int err = blk_status_to_errno(READ_ONCE(priv->status));
> +
> +			btrfs_uring_read_extent_endio(uring_ctx, err);
>   			kfree(priv);
> -			return ret;
>   		}
>   
>   		return -EIOCBQUEUED;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.