public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: ctree: Dump the leaf before BUG_ON()
@ 2019-04-24 12:48 Qu Wenruo
  2019-04-24 12:52 ` Nikolay Borisov
  0 siblings, 1 reply; 5+ messages in thread
From: Qu Wenruo @ 2019-04-24 12:48 UTC (permalink / raw)
  To: linux-btrfs

We have a user reporting BUG_ON() triggered in
btrfs_set_item_key_safe().

Let's dump the leaf content before triggering BUG_ON() so that we can
have some clue on what's going wrong.
The output of tree locks should help us to debug such problem.

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

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index f52eb952597b..c769a7b50ba4 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3185,10 +3185,12 @@ void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
 	slot = path->slots[0];
 	if (slot > 0) {
 		btrfs_item_key(eb, &disk_key, slot - 1);
+		btrfs_print_leaf(eb);
 		BUG_ON(comp_keys(&disk_key, new_key) >= 0);
 	}
 	if (slot < btrfs_header_nritems(eb) - 1) {
 		btrfs_item_key(eb, &disk_key, slot + 1);
+		btrfs_print_leaf(eb);
 		BUG_ON(comp_keys(&disk_key, new_key) <= 0);
 	}
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-24 13:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-24 12:48 [PATCH] btrfs: ctree: Dump the leaf before BUG_ON() Qu Wenruo
2019-04-24 12:52 ` Nikolay Borisov
2019-04-24 12:55   ` Qu Wenruo
2019-04-24 13:53     ` Filipe Manana
2019-04-24 13:55       ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox