Re: [PATCH 08/19] btrfs: make unmirroed BGs readonly only if we have at least one writable BG

From: Naohiro Aota
Date: Tue Jun 18 2019 - 03:47:51 EST


On 2019/06/13 23:09, Josef Bacik wrote:
> On Fri, Jun 07, 2019 at 10:10:14PM +0900, Naohiro Aota wrote:
>> If the btrfs volume has mirrored block groups, it unconditionally makes
>> un-mirrored block groups read only. When we have mirrored block groups, but
>> don't have writable block groups, this will drop all writable block groups.
>> So, check if we have at least one writable mirrored block group before
>> setting un-mirrored block groups read only.
>>
>
> I don't understand why you want this. Thanks,
>
> Josef
>

This is necessary to handle e.g. btrfs/124 case.

When we mount degraded RAID1 FS and write to it, and then
re-mount with full device, the write pointers of corresponding
zones of written BG differ. The patch 07 mark such block group
as "wp_broken" and make it read only. In this situation, we only
have read only RAID1 BGs because of "wp_broken" and un-mirrored BGs
are also marked read only, because we have RAID1 BGs.
As a result, all the BGs are now read only, so that we
cannot even start the rebalance to fix the situation.