On Tue, Dec 17, 2019 at 02:25:37PM -0500, Josef Bacik wrote:
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
First of all, I found that some recent change (maybe commit
112974d4067b ("btrfs: volumes: Remove ENOSPC-prone
btrfs_can_relocate()")?) solved the issue, so we no longer need patch
11 and 12. So, I will drop these two in the next version.
So, I think you may already have no interest on the answer, but just
for a note... The situation was like this:
* before degrading
- All block groups are RAID1, working fine.
* degraded mount
- Block groups allocated before degrading are RAID1. Writes goes
into RAID1 block group and break the write pointer.
- Newly allocated block groups are SINGLE, since we only have one
available device.
* mount with the both drive again
- RAID1 block groups are markd RO because of broken write pointer
- SINGLE block groups are also marked RO because we have RAID1 block
groups
and at this point, btrfs was somehow unable to allocate new block
group or to start blancing.