From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Hengyu Liang <hengyul@cs.unc.edu>, linux-btrfs@vger.kernel.org
Cc: Qu Wenruo <wqu@suse.com>, Boris Burkov <boris@bur.io>,
David Sterba <dsterba@suse.com>, Chris Mason <mason@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: remove "rescue=usebackuproot" from "rescue=all" shortcut
Date: Tue, 17 Nov 2026 14:53:31 +1030 [thread overview]
Message-ID: <9155e9f6-9d76-43b3-bd20-a4c98a9f2c84@gmx.com> (raw)
In-Reply-To: <20261117030353.1738805-1-hengyul@cs.unc.edu>
在 2026/11/17 13:33, Hengyu Liang 写道:
> [BUG]
Don't use [BUG][CAUSE][FIX] sections for a very simple behavior change.
You should not use this detailed method for such a simple behavior.
> Since commit c73eb6f72741 ("btrfs: always use the second newest slot for
> rescue=usebackuproot"), "mount -o ro,rescue=all" mounts the second
> newest backup root even when the newest roots are fine. As of now, the
> changes of the last transaction are not visible with "rescue=all".
Furthermore, one can even argue that this behavior gives a higher chance
to mount the fs.
Thus counting this as a bug is very weak argument, thus the whole point
of your patch may not even stand.
>
> The issue can be reproduced with a healthy filesystem:
>
> mkfs.btrfs -q -f /dev/vda
> mount /dev/vda /mnt
> echo old > /mnt/A
> echo old > /mnt/C
> sync
> echo new > /mnt/A
> echo new > /mnt/B
> rm /mnt/C
> umount /mnt
> mount -o ro,rescue=all /dev/vda /mnt
> ls /mnt
> cat /mnt/A
>
> Before that commit, the result is "A B" and "new". After that commit,
> the result is "A C" and "old".
>
> [CAUSE]
> Commit 2fd3f6a2711b ("btrfs: add "rescue=usebackuproot" into
> "rescue=all" shortcut") added USEBACKUPROOT to "rescue=all". At that
> time the option only fell back to a backup root when the newest roots
> failed to load. Now btrfs_parse_param() sets USEBACKUPROOT and
> use_backup_slot = 1 for "rescue=all", and init_tree_roots() calls
> read_backup_root(fs_info, 1) before it loads the tree root.
>
> [FIX]
> "rescue=usebackuproot" now selects a root instead of tolerating an
> error, so remove it from "rescue=all". With this change "rescue=all"
> never uses a backup root by itself. When the newest roots are damaged,
> "rescue=usebackuproot" has to be given in addition.
>
> Fixes: c73eb6f72741 ("btrfs: always use the second newest slot for rescue=usebackuproot")
> Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
> ---
> This is new in 7.4-rc (v7.3 mounts the newest roots with "rescue=all"),
> so it can be judged before the release.
>
> On a copy of a disk taken while the next transaction was running,
> "rescue=all" on v7.4-rc2 showed 30 of 60 files with the data of other
> files and no read error, as the space freed by the newest transaction
> was reused and data checksums are ignored.
>
> If "rescue=all" should keep every rescue option, as btrfs-progs
> documents it, using slot 0 for it also shows the newest state, and I
> can send that instead.
>
> Tested on btrfs for-next (26eb4d70f96d) with clean mkfs.btrfs images:
> healthy, a damaged data block, a damaged extent, csum, fs or tree root
> block, and the disk copy above.
Remove ChatGPT garbage next time.
Or use your human brain cells to determine whether this makes any sense,
and check all the patches from known developers for the styles to
follow, other than blindly accept whatever chatGPT generated.
No one cares how your stupid agent tested the patch.
If you explained the patch well enough, no one need to waste his/her
time on this BS testing steps.
If not explained well, then the testing part is totally BS.
Furthermore, you should not just change this without a doc update.
>
> fs/btrfs/super.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index b424cc836bd4..d67d678451f6 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -624,8 +624,6 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
> btrfs_set_opt(ctx->mount_opt, IGNORESUPERFLAGS);
> btrfs_set_opt(ctx->mount_opt, IGNOREBADROOTS);
> btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
> - btrfs_set_opt(ctx->mount_opt, USEBACKUPROOT);
> - ctx->use_backup_slot = 1;
> break;
> default:
> btrfs_info(NULL, "unrecognized rescue option '%s'",
>
> base-commit: 26eb4d70f96d9bf99e87c2565d6234eb652f9c26
prev parent reply other threads:[~2026-11-17 4:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 3:03 Hengyu Liang
2026-11-17 4:23 ` Qu Wenruo [this message]
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=9155e9f6-9d76-43b3-bd20-a4c98a9f2c84@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=boris@bur.io \
--cc=dsterba@suse.com \
--cc=hengyul@cs.unc.edu \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--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®