Re: [PATCH] btrfs: scrub: don't count zoned repairs as corrected on a degraded mount
From: Qu Wenruo
Date: Thu Nov 19 2026 - 17:34:01 EST
在 2026/11/20 08:19, Miroslav Cimerman 写道:
Qu Wenruo <quwenruo.btrfs@xxxxxxx> wrote:
If it's a workaround for the well known new-SINGLE chunks during
degraded writes, it may be a little over-killed.
True, balance and block group reclaim already relocate block groups on
degraded mounts with no such check.
I'm more concerned if it's some extra requirement for zoned RAID
profiles, e.g. to keep the writer pointers in sync etc.
None that the repair would break: a regular mount needs equal write
pointers, but a missing device falls behind on every degraded write
anyway, not only on a repair. The problem is when that device comes
back stale: two days ago my tester found that a degraded mount could
then allocate over committed extents, which aborted the transaction or
crashed. The series "btrfs: zoned: RAID1 block groups with missing or
stale stripes" fixes that:
https://lore.kernel.org/linux-btrfs/20261119213835.103131-1-mc@xxxxxxxxxxx/
In testing with the skip removed, the relocation with a device really
missing works: RAID1 on three devices stays RAID1, RAID1C3 on three
devices gets single block groups, a second scrub is clean, and the
missing device mounts normally when it comes back.
One thing it needs: without the skip, a degraded mount that reads a bad
copy starts the relocation during mount. In testing, it raced with the
mount, which failed and hit the uncommitted transaction ASSERT on its
error path. "btrfs: zoned: wait for the relocating repair kthread
during unmount" prevents that: with it, no repair starts before
BTRFS_FS_OPEN is set:
https://lore.kernel.org/linux-btrfs/20261118004808.201460-1-mc@xxxxxxxxxxx/
And I'd prefer if you can get some helper to know if this block group
can be repaired, so that no duplicated checks between repair and scrub.
With that repair kthread patch, the skip can be dropped completely,
so no check is left to share, and scrub needs no change for degraded
mounts. It still counts errors as corrected when a repair is not
started, e.g. while another one runs, just as on a regular mount.
In testing, with the series and the repair kthread patch applied and
the skip removed, a stale device came back. A few scrubs on the
degraded mount relocated the block groups it was behind on, and then a
regular mount worked again, without a balance. Only a block group where
scrub finds no error still needs a balance, e.g. when the missed range
holds only nodatasum data.
One downside: when fewer devices are left than the profile needs, the
repair relocates the block group as single, without the missing
device's copy. A RAID1C3 or RAID1C4 block group then keeps one copy
until a balance. Without the repair, it would get its copies back when
the device returns.
Are you OK with a v2 that drops the skip completely, on top of that
repair kthread patch?
I'm fine dropping that check, but it would be better to be a dedicated patch for extra review from zoned experts.
Thanks,
Qu
Thanks,
Miroslav