Re: [PATCH v2 0/3] btrfs-progs: mkfs: make sure we can clean up all temporary chunks

David Sterba
2021-10-11T14:07:48Z

On Mon, Oct 11, 2021 at 08:06:47PM +0800, Qu Wenruo wrote:
> There is a bug report that with certain mkfs options, mkfs.btrfs may
> fail to cleanup some temporary chunks, leading to "btrfs filesystem df"
> warning about multiple profiles:
>
> WARNING: Multiple block group profiles detected, see 'man btrfs(5)'.
> WARNING: Metadata: single, raid1
>
> The easiest way to reproduce is "mkfs.btrfs -f -R free-space-tree -m dup
> -d dup".
>
> It turns out that, the old _recow_root() can not handle tree levels > 0,
> while with newer free space tree creation timing, the free space tree
> can reach level 1 or higher.
>
> To fix the problem, Patch 2 will do the proper full tree re-CoW, with
> extra transaction commitment to make sure all free space tree get
> re-CoWed.

The extra commit breaks assumptions of test misc/038 that looks up the
backup roots in particular slot(s). I already had to fix it once due to
the additional commit with free space tree. Now it broke again, the test
is too fragle, I'm not sure we want to keep doing the whack-a-mole.