Skip to content

btrfs: raid56: make raid56 to use more accurate error bitmap for error detection

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: raid56: introduce btrfs_raid_bio::error_bitmapfs/btrfs/raid56.c fs/btrfs/raid56.h+108 -71 reply
2/3btrfs: raid56: migrate recovery and scrub recovery path to use error_bitmapfs/btrfs/raid56.c+195 -860 replies
3/3btrfs: raid56: remove the old error tracing systemfs/btrfs/raid56.c fs/btrfs/raid56.h+55 -1880 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs: raid56: make raid56 to use more accurate error bitmap for error detection

Currently btrfs raid56 uses stripe based error detection.

This means, any error (which vary from single sector csum mismatch, to a missing device) will mark the whole horizontal stripe as error.

This can lead to some unexpected behavior, for example:

             0        32K       64K
     Data 1  |XXXXXXXX|         |
     Data 2  |        |XXXXXXXXX|
     Parity  |        |         |

When reading data 1 [0, 32K), we got csum mismatch and go RAID56 recovery path.

If going the old path, we will mark the whole data 1 [0, 64K) all as error, and recover using data 2 and parity.

But since data 2 [32K, 64K) is also corrupted, the recovered data will also be corrupted.

Thankfully such problem will be mostly avoided after commit f6065f8edeb2 ("btrfs: raid56: don't trust any cached sector in __raid56_parity_recover()"), as when we read the sectors in data 2 [32K, 64K), we will recover discarding all the cached result.

This patchset will change the behavior by introducing an error bitmap, recording corrupted sector one by one, so for above case, at least we won't try to recover data 1 [32K, 64K) using incorrect data.

The true solution to this destructive RMW problem will be read time csum verification, but this patchset introduces the basis to handle extra csum mismatch error better (csum mismatch will also be marked as error, but only for the offending sectors).

This patchset itself doesn't improve the raid56 destructive RMW situation by itself, but would make later destructive RMW fix much easier to implement.

Qu Wenruo (3):
btrfs: raid56: introduce btrfs_raid_bio::error_bitmap
btrfs: raid56: migrate recovery and scrub recovery path to use
error_bitmap
btrfs: raid56: remove the old error tracing system

 fs/btrfs/raid56.c | 572 ++++++++++++++++++++++++++--------------------
 fs/btrfs/raid56.h |  19 +-
 2 files changed, 334 insertions(+), 257 deletions(-)
Signature · 1 line
2.38.1