btrfs: add error message for metadata level mismatch
authorQu Wenruo <wqu@suse.com>
Wed, 28 Dec 2022 23:32:23 +0000 (07:32 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Jan 2023 14:53:18 +0000 (15:53 +0100)
From a recent regression report, we found that after commit 947a629988f1
("btrfs: move tree block parentness check into
validate_extent_buffer()") if we have a level mismatch (false alert
though), there is no error message at all.

This makes later debugging harder.  This patch will add the proper error
message for such case.

Link: https://lore.kernel.org/linux-btrfs/CABXGCsNzVxo4iq-tJSGm_kO1UggHXgq6CdcHDL=z5FL4njYXSQ@mail.gmail.com/
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c

index 0888d48..9940cc3 100644 (file)
@@ -530,6 +530,9 @@ static int validate_extent_buffer(struct extent_buffer *eb,
        }
 
        if (found_level != check->level) {
+               btrfs_err(fs_info,
+               "level verify failed on logical %llu mirror %u wanted %u found %u",
+                         eb->start, eb->read_mirror, check->level, found_level);
                ret = -EIO;
                goto out;
        }