diff mbox series

[2/2] btrfs-progs: check: add advice to avoid --init-csum-tree

Message ID f97557777956f2369d988f0cc6d5cf2d3aae4172.1692688214.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: rely on "btrfstune --csum" to replace "btrfs check --init-csum-tree" | expand

Commit Message

Qu Wenruo Aug. 22, 2023, 7:15 a.m. UTC
We already had a report about "btrfs check --init-csum-tree" screwing up
a seemingly fine btrfs (which can pass "btrfs check --readonly" without
error).

This is mostly due to the fact that --init-csum-tree just screw up the
csum tree root, and rely on extent tree repair code to repair the damage
caused by ourselves.

This patch would recommend the end users to go "btrfstune --csum" if
that option is present.

This has some extra benefits:

- More protection/tests on interrupred conversion

- No unrelated changes to subvolume and extent trees
  But this requires the original fs to be mostly fine.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 check/main.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/check/main.c b/check/main.c
index d66e10e8fd4d..9a52463269b1 100644
--- a/check/main.c
+++ b/check/main.c
@@ -10153,6 +10153,15 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 		printf("\tsome software or hardware bugs can fatally damage a volume.\n");
 		printf("\tThe operation will start in %d seconds.\n", delay);
 		printf("\tUse Ctrl-C to stop it.\n");
+
+#if EXPERIMENTAL
+		if (init_csum_tree) {
+			printf("\n");
+			printf("\t--init-csum-tree is considered dangerous, if your fs is fine,\n");
+			printf("\tplease use \"btrfstune --csum\" instead, which is considered\n");
+			printf("\tmuch safer\n");
+		}
+#endif
 		while (delay) {
 			printf("%2d", delay--);
 			fflush(stdout);