[3/3] btrfs: Enhance the error outputting for write time tree checker
diff mbox series

Message ID 20191004093133.83582-4-wqu@suse.com
State New
Headers show
  • btrfs: tree-checker: False alerts fixes for log trees
Related show

Commit Message

Qu WenRuo Oct. 4, 2019, 9:31 a.m. UTC
Unlike read time tree checker error, write time error can't be inspected
by "btrfs ins dump-tree", so we need extra info to determine what's
going wrong.

The patch will add the following output for write time tree checker
- The content of the offending tree block
  To help determining if it's a false alert.

- Kernel WARN_ON() for debug build
  This is helpful for us to detect unexpected write time tree checker
  error, especially fstests could catch the dmesg.
  Since the WARN_ON() is only triggered for write time tree checker,
  test cases utilizing dm-error won't trigger this WARN_ON(), thus no
  extra noise.

Signed-off-by: Qu Wenruo <wqu@suse.com>
 fs/btrfs/disk-io.c | 2 ++
 1 file changed, 2 insertions(+)

diff mbox series

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 16dc60b4966d..a0925b4e00af 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -545,9 +545,11 @@  static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
 		ret = btrfs_check_leaf_full(eb);
 	if (ret < 0) {
+		btrfs_print_tree(eb, 0);
 		"block=%llu write time tree block corruption detected",
 		return ret;
 	write_extent_buffer(eb, result, 0, csum_size);