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

Qu Wenruo
2021-10-11T22:56:19Z

On 2021/10/11 22:39, David Sterba wrote:
> On Mon, Oct 11, 2021 at 04:05:18PM +0200, David Sterba wrote:
>> 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.
>
> I've check it with the v2, no change, so I'll disable the test.
>

I'll update the test case to make it more flex to handle the extra commits.

The proper way to test the behavior is not to use the hardcoded slot
number, but auto-detect the slot.

Thanks,
Qu