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 uncertain how this bug can be triggered, but adding such
debug output will provide more info for us to debug.

Signed-off-by: Qu Wenruo <w...@suse.com>
---
 extent-tree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/extent-tree.c b/extent-tree.c
index 1cff617baa97..db69c538bf2f 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2177,6 +2177,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;
        }
-- 
2.21.0

Reply via email to