On 12/12/19 11:08 PM, 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. This change is necessary to handle e.g. xfstests 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 block group differ. We mark such block group as "wp_broken" and make it read only. In this situation, we only have read only RAID1 block groups because of "wp_broken" and un-mirrored block groups are also marked read only, because we have RAID1 block groups. As a result, all the block groups are now read only, so that we cannot even start the rebalance to fix the situation.
I'm not sure I understand. In degraded mode we're writing to just one mirror of a RAID1 block group, correct? And this messes up the WP for the broken side, so it gets marked with wp_broken and thus RO. How does this patch help? The block groups are still marked RAID1 right? Or are new block groups allocated with SINGLE or RAID0? I'm confused. Thanks,
Josef