Commit 63489055 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: Always output error message when key/level verification fails

We have internal report of strange transaction abort due to EUCLEAN
without any error message.

Since error message inside verify_level_key() is only enabled for
CONFIG_BTRFS_DEBUG, the error message won't be printed on most builds.

This patch will make the error message mandatory, so when problem
happens we know what's causing the problem.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 448de471
...@@ -404,12 +404,11 @@ int btrfs_verify_level_key(struct btrfs_fs_info *fs_info, ...@@ -404,12 +404,11 @@ int btrfs_verify_level_key(struct btrfs_fs_info *fs_info,
found_level = btrfs_header_level(eb); found_level = btrfs_header_level(eb);
if (found_level != level) { if (found_level != level) {
#ifdef CONFIG_BTRFS_DEBUG WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
WARN_ON(1); KERN_ERR "BTRFS: tree level check failed\n");
btrfs_err(fs_info, btrfs_err(fs_info,
"tree level mismatch detected, bytenr=%llu level expected=%u has=%u", "tree level mismatch detected, bytenr=%llu level expected=%u has=%u",
eb->start, level, found_level); eb->start, level, found_level);
#endif
return -EIO; return -EIO;
} }
...@@ -430,9 +429,9 @@ int btrfs_verify_level_key(struct btrfs_fs_info *fs_info, ...@@ -430,9 +429,9 @@ int btrfs_verify_level_key(struct btrfs_fs_info *fs_info,
btrfs_item_key_to_cpu(eb, &found_key, 0); btrfs_item_key_to_cpu(eb, &found_key, 0);
ret = btrfs_comp_cpu_keys(first_key, &found_key); ret = btrfs_comp_cpu_keys(first_key, &found_key);
#ifdef CONFIG_BTRFS_DEBUG
if (ret) { if (ret) {
WARN_ON(1); WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
KERN_ERR "BTRFS: tree first key check failed\n");
btrfs_err(fs_info, btrfs_err(fs_info,
"tree first key mismatch detected, bytenr=%llu parent_transid=%llu key expected=(%llu,%u,%llu) has=(%llu,%u,%llu)", "tree first key mismatch detected, bytenr=%llu parent_transid=%llu key expected=(%llu,%u,%llu) has=(%llu,%u,%llu)",
eb->start, parent_transid, first_key->objectid, eb->start, parent_transid, first_key->objectid,
...@@ -440,7 +439,6 @@ int btrfs_verify_level_key(struct btrfs_fs_info *fs_info, ...@@ -440,7 +439,6 @@ int btrfs_verify_level_key(struct btrfs_fs_info *fs_info,
found_key.objectid, found_key.type, found_key.objectid, found_key.type,
found_key.offset); found_key.offset);
} }
#endif
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment