Skip to content

btrfs-progs: rely on "btrfstune --csum" to replace "btrfs check --init-csum-tree"

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs-progs: tune: allow --csum to rebuild csum treetune/change-csum.c tune/main.c+27 -110 replies
2/2btrfs-progs: check: add advice to avoid --init-csum-treecheck/main.c+9 -00 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/2] btrfs-progs: rely on "btrfstune --csum" to replace "btrfs check --init-csum-tree"

We had a report that "btrfs check --init-csum-tree" corrupted a seemingly fine btrfs (which can originally pass "btrfs check --readonly").

The root cause is in how we rebuild the csum tree, in the btrfs check code, we screw up the csum tree root, then rely on the extent tree repair code to finish the damage we introduced.

This can lead to unexpected corner cases, if the fs is already fine, there is no need for such risky move.

Considering there are valid ways to cause data csum mismatch (mostly O_DIRECT and modifying the buffer when it's still under writeback), some users expect to use "btrfs check --init-csum-tree" to fix the csum mismatch, which can lead to the same corruption.

Instead this patchset would recommend the end users to go "btrfstune --csum", as it is way less risky by its design, and no more damage to the fs caused by ourselves.

I hope we can completely go that direction when the "btrfstune --csum" option is moved out of experimental features.

Qu Wenruo (2):
btrfs-progs: tune: allow --csum to rebuild csum tree
btrfs-progs: check: add advice to avoid --init-csum-tree

 check/main.c       |  9 +++++++++
 tune/change-csum.c | 35 +++++++++++++++++++++++++----------
 tune/main.c        |  3 ++-
 3 files changed, 36 insertions(+), 11 deletions(-)

--
2.41.0