Re: [PATCH] btrfs: remove "rescue=usebackuproot" from "rescue=all" shortcut

From: Qu Wenruo

Date: Wed Nov 25 2026 - 15:25:44 EST




在 2026/11/26 03:47, Hengyu Liang 写道:
Hi Qu,

I found this while comparing the behaviour of different kernel versions.
I used an LLM to analyse the problem and to draft the patch and this
message, and I analyzed the result myself.

Then you should also stop waste human time on reading such long word salads.


On 2026/11/17 14:53, Qu Wenruo wrote:
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.

I agree that slot 1 helps when the newest tree root is damaged. But
"rescue=all" is also what people use to copy data off after an unclean
shutdown, and there slot 1 can be worse than the newest roots:

1. The data extents freed by the last committed transaction can already
hold data of the transaction that did not commit,

That's not a problem, COW makes sure the old data can still be reached.

while slot 1 still
points to them, and ignoredatacsums reads them without an error. In
my test, user A deleted 30 of 60 files in the last transaction, then
user B wrote and fsynced 60 private (0600) files before a power cut
(I used a copy of the disk taken at that point).

And fsync is a different behavior. Fsynced data are only in log tree.
No matter if you use the newest slot or not, as long as you ignore the log tree, those new deletion will not be seen anyway.

With
"ro,rescue=all", A's deleted files are back, and 30 of A's files,
owned by A, contain B's data. Copying the data off with the owners
kept hands B's data to A. With the newest roots (v7.3, or
"rescue=all,rescue=usebackuproot_0" now), A sees only the 30 current
files with A's own data.

2. On the same disk, "ro,rescue=usebackuproot" fails with "chunk ...
has missing dev extent" (-EUCLEAN), while the newest roots mount
without errors. I also have a syzkaller image that mounts with
ignorebadroots and usebackuproot (plus some unrelated options) on
the parent of c73eb6f72741 and fails with -EIO on that commit: slot 1
has a bad checksum,

That's the problem, and users always have the solution to choose which slot to use.

the newest roots load. So slot 1 does not always
give a better chance to mount.

I have two suggestions, but in the end it is your call:

a) "rescue=all" tries the newest roots first and falls back to slot 1
only when the mount fails with them (similar to the retry Boris
suggested in his review of your series).

b) Keep slot 1 for "rescue=all", and document in btrfs-progs that an
older slot can point to reused data blocks, which ignoredatacsums
then reads without errors.

Nope, not for slot 1 at least.

Data COW ensures it won't write data into an extent just released in the current transaction.


Thanks,
Hengyu