From c98155f07a460db41bc4b75504f2d9172f48cada Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Mon, 27 May 2019 12:22:04 +0800 Subject: [PATCH] btrfs-progs: Output extent tree leaf if we failed to find a backref There is a bug report of BUG_ON() which is caused by __free_extent() failed to lookup a backref extent: Failed to find [1429288337408, 168, 16384] btrfs unable to find ref byte nr 1429288583168 parent 0 root 2 owner 0 offset 0 convert/source-ext2.c:834: ext2_copy_inodes: BUG_ON ret triggered, value -5 ./btrfs-convert[0x410941] ./btrfs-convert(main+0x1fdc)[0x40d3b8] /lib64/libc.so.6(__libc_start_main+0xf3)[0x7f93bb7d2f33] ./btrfs-convert(_start+0x2e)[0x40a96e] It's still unclear how this bug can be triggered, but adding such debug output will provide more info for us to debug. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- extent-tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index e62ee8c2..98a8cacf 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -2176,6 +2176,8 @@ static int __free_extent(struct btrfs_trans_handle *trans, (unsigned long long)root_objectid, (unsigned long long)owner_objectid, (unsigned long long)owner_offset); + printf("path->slots[0]: %u path->nodes[0]:\n", path->slots[0]); + btrfs_print_leaf(path->nodes[0]); ret = -EIO; goto fail; }