Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Yang Xiuwei <yangxiuwei@kylinos.cn>, Chris Mason <clm@fb.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, Mark Harmstone <maharmstone@fb.com>,
	Yue Sun <samsun1006219@gmail.com>, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH 2/3] btrfs: always return -EIOCBQUEUED after btrfs_uring_read_extent_endio
Date: Wed, 5 Aug 2026 12:51:49 +0930	[thread overview]
Message-ID: <16f7f1b7-4692-465f-9e79-a4d1cc447f69@gmx.com> (raw)
In-Reply-To: <20260805021135.1896609-3-yangxiuwei@kylinos.cn>



在 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 <samsun1006219@gmail.com>
> Closes: https://lore.kernel.org/linux-btrfs/20260630091609.3414-1-samsun1006219@gmail.com/
> Suggested-by: Jens Axboe <axboe@kernel.dk>
> Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
> Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>

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;


  reply	other threads:[~2026-08-05  3:22 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 [this message]
2026-08-05  4:18     ` Yang Xiuwei
2026-08-05  2:11 ` [PATCH 3/3] btrfs: free iov when btrfs_uring_read_extent fails Yang Xiuwei

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=16f7f1b7-4692-465f-9e79-a4d1cc447f69@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=axboe@kernel.dk \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=maharmstone@fb.com \
    --cc=samsun1006219@gmail.com \
    --cc=yangxiuwei@kylinos.cn \
    /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