Re: [PATCH V2] btrfs: btrfs can not be mounted with corrupted extent root

From: Lizhi Xu
Date: Thu Jan 02 2025 - 04:45:54 EST


On Thu, 2 Jan 2025 18:51:34 +1030, Qu Wenruo wrote:
> > syzbot reported a null-ptr-deref in find_first_extent_item. [1]
> >
> > The btrfs filesystem did not successfully initialize extent root to the
> > global root tree when mounted(as the mount options contain ignorebadroots),
> > this is because extent buffer is not uptodate,
>
> The "not uptodate" is only the symptom, if you check the console output
> carefully enough, it's because the extent tree root (and must be extent
> tree root, any child node won't cause problem) is corrupted (csum mismatch).
>
[ 35.752834][ T3330] BTRFS warning (device loop0): checksum verify failed on logical 5337088 mirror 1 wanted 0x324c5e2d0cac2dc8f61cbfdfc8cd69d9816061b1498b9e1bff0
According to the above log, it is clear that the failure of btrfs_validate_extent_buffer()
causes the extent buffer to be not uptodate, and it can be judged that extent root is corrupted.

BR,
Lizhi