btrfs: improve error message after failure to add delayed dir index item
authorFilipe Manana <fdmanana@suse.com>
Mon, 28 Aug 2023 08:06:42 +0000 (09:06 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 8 Sep 2023 12:11:57 +0000 (14:11 +0200)
commit91bfe3104b8db0310f76f2dcb6aacef24c889366
tree80b5819669c6337c57636a46ea2aa383a437f128
parent5e0e879926c1ce7e1f5e0dfaacaf2d105f7d8a05
btrfs: improve error message after failure to add delayed dir index item

If we fail to add a delayed dir index item because there's already another
item with the same index number, we print an error message (and then BUG).
However that message isn't very helpful to debug anything because we don't
know what's the index number and what are the values of index counters in
the inode and its delayed inode (index_cnt fields of struct btrfs_inode
and struct btrfs_delayed_node).

So update the error message to include the index number and counters.

We actually had a recent case where this issue was hit by a syzbot report
(see the link below).

Link: https://lore.kernel.org/linux-btrfs/00000000000036e1290603e097e0@google.com/
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-inode.c