From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Siddharth Mishra <smish149@asu.edu>, dsterba@suse.com
Cc: wqu@suse.com, boris@bur.io, josef@toxicpanda.com,
fdmanana@suse.com, mason@kernel.org, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/5] btrfs: owner refs and tree blocks
Date: Thu, 5 Nov 2026 09:20:51 +1030 [thread overview]
Message-ID: <9de049c9-429b-46f8-90e7-02b30d2e91ee@gmx.com> (raw)
In-Reply-To: <20261104102323.4090290-1-smish149@asu.edu>
在 2026/11/4 20:53, Siddharth Mishra 写道:
> Simple quotas store the owner of a data extent in an inline owner ref.
> Tree blocks never get one: their owner is in the tree block header.
>
> Patch 1 fixes btrfs_get_extent_owner_root(), which also looks for an
> owner ref on tree blocks. On a filesystem without skinny-metadata it
> reads the btrfs_tree_block_info as an inline ref and warns on subvolume
> deletion, snapshot writes and balance. The filesystem is valid.
>
> Patches 2 and 3 are hardening. The tree-checker rejects refs whose type
> does not match the extent type: inline refs in patch 2 (for example an
> owner ref on a tree block), and keyed refs in the same leaf as their
> extent item in patch 3.
>
> Patches 4 and 5 are for btrfs-progs (devel 3737c260) and have the same
> cause: a tree block without skinny-metadata is taken for data. mkfs and
> btrfs check do not count such tree blocks in simple quotas, and
> btrfstune --remove-simple-quota can corrupt their extent items.
>
> Found by fuzzing. An AI tool helped with the analysis and the patches.
>
> Tested on btrfs for-next df5b88a7914e, KASAN and non-debug kernels:
> - Patch 1: no warning on subvolume deletion, snapshot writes and
> metadata balance without skinny-metadata; same qgroup numbers.
> - Patches 2 and 3: crafted images with an owner ref on a tree block,
> and with a keyed tree block ref on a data extent, are refused at
> read time instead of aborting a transaction later. No valid
> filesystem was rejected: skinny and non-skinny, 4K nodes, mixed block
> groups, no quota, qgroups and simple quotas, with reflinks, snapshots,
> balance and scrub, and filesystems from btrfs-convert, mkfs --rootdir
> and btrfstune -x.
> - fstests btrfs/quick, and the qgroup, balance, snapshot and subvol
> groups with -O ^skinny-metadata: no new failure.
> - Patches 4 and 5: mkfs -O squota,^skinny-metadata writes the right
> qgroup counts; btrfstune --remove-simple-quota leaves the tree blocks
> intact and btrfs check is clean (before: "backpointer mismatch").
>
> The crafted images are available on request.
>
> Siddharth Mishra (5):
> btrfs: skip tree blocks in btrfs_get_extent_owner_root()
> btrfs: tree-checker: reject inline refs not matching the extent type
> btrfs: tree-checker: reject keyed refs not matching the extent type
> btrfs-progs: check: count non-skinny tree blocks in simple quotas
> btrfs-progs: tune: do not remove owner refs from tree blocks
Please, never mixed progs and kernel patches in one series.
Send them out separately.
>
> fs/btrfs/extent-tree.c | 3 +++
> fs/btrfs/tree-checker.c | 56 +++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 57 insertions(+), 2 deletions(-)
>
> check/qgroup-verify.c | 5 +++--
> tune/quota.c | 4 +++-
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
>
> base-commit: df5b88a7914e18488908ddf13e14e31ab39f954c
next prev parent reply other threads:[~2026-11-04 22:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 10:23 Siddharth Mishra
2026-11-04 10:23 ` [PATCH 1/5] btrfs: skip tree blocks in btrfs_get_extent_owner_root() Siddharth Mishra
2026-11-04 19:13 ` Boris Burkov
2026-11-04 10:23 ` [PATCH 2/5] btrfs: tree-checker: reject inline refs not matching the extent type Siddharth Mishra
2026-11-04 19:24 ` Boris Burkov
2026-11-04 19:56 ` Siddharth Mishra
2026-11-04 10:23 ` [PATCH 3/5] btrfs: tree-checker: reject keyed " Siddharth Mishra
2026-11-04 19:29 ` Boris Burkov
2026-11-04 10:23 ` [PATCH 4/5] btrfs-progs: check: count non-skinny tree blocks in simple quotas Siddharth Mishra
2026-11-04 19:21 ` Boris Burkov
2026-11-04 21:30 ` [PATCH v2] " Siddharth Mishra
2026-11-04 10:23 ` [PATCH 5/5] btrfs-progs: tune: do not remove owner refs from tree blocks Siddharth Mishra
2026-11-04 19:18 ` Boris Burkov
2026-11-04 22:50 ` Qu Wenruo [this message]
2026-11-04 23:16 ` [PATCH 0/5] btrfs: owner refs and " Siddharth Mishra
2026-11-04 23:17 ` Qu Wenruo
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=9de049c9-429b-46f8-90e7-02b30d2e91ee@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=boris@bur.io \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=smish149@asu.edu \
--cc=wqu@suse.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
all inboxes | Powered by JetHome®