Linux Btrfs filesystem development
 help / color / mirror / Atom feed
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 0/3] btrfs: fix io_uring encoded read cleanup paths
Date: Wed,  5 Aug 2026 10:11:32 +0800	[thread overview]
Message-ID: <20260805021135.1896609-1-yangxiuwei@kylinos.cn> (raw)

Three related bugs in the io_uring ENCODED_READ path:

1. pages array allocation failure returned -ENOMEM without unlocking
   the inode and extent locks taken by btrfs_encoded_read().

2. If bios completed before fill_pages returned, endio already queued
   btrfs_uring_read_finished(), but a negative I/O status made the
   caller clean up as well.  This matches the GPF reported by Yue Sun;
   patch 2 follows Jens Axboe's suggestion.

   Link: https://lore.kernel.org/linux-btrfs/20260630091609.3414-1-samsun1006219@gmail.com/

3. After btrfs_uring_read_extent() failed, the caller skipped
   kfree(data->iov) by always jumping to out_acct.

Yang Xiuwei (3):
  btrfs: unlock inode and extent on pages alloc failure in uring read
  btrfs: always return -EIOCBQUEUED after btrfs_uring_read_extent_endio
  btrfs: free iov when btrfs_uring_read_extent fails

 fs/btrfs/inode.c |  7 +++----
 fs/btrfs/ioctl.c | 18 +++++++++++-------
 2 files changed, 14 insertions(+), 11 deletions(-)

-- 
2.25.1


             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 Yang Xiuwei [this message]
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 ` [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=20260805021135.1896609-1-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