* [PATCH] btrfs: Always output error message when key/level verification fails
@ 2019-01-17 1:27 Qu Wenruo
2019-01-17 6:30 ` Nikolay Borisov
0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2019-01-17 1:27 UTC (permalink / raw)
To: linux-btrfs
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 output for most distro.
This patch will make the error message mandatory, so when problem
happens we know what's causing the problem.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/disk-io.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 45bf6be9e751..d04ae6deba94 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -435,10 +435,10 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
if (found_level != level) {
#ifdef CONFIG_BTRFS_DEBUG
WARN_ON(1);
+#endif
btrfs_err(fs_info,
"tree level mismatch detected, bytenr=%llu level expected=%u has=%u",
eb->start, level, found_level);
-#endif
return -EIO;
}
@@ -459,9 +459,10 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
btrfs_item_key_to_cpu(eb, &found_key, 0);
ret = btrfs_comp_cpu_keys(first_key, &found_key);
-#ifdef CONFIG_BTRFS_DEBUG
if (ret) {
+#ifdef CONFIG_BTRFS_DEBUG
WARN_ON(1);
+#endif
btrfs_err(fs_info,
"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,
@@ -469,7 +470,6 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
found_key.objectid, found_key.type,
found_key.offset);
}
-#endif
return ret;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: Always output error message when key/level verification fails
2019-01-17 1:27 [PATCH] btrfs: Always output error message when key/level verification fails Qu Wenruo
@ 2019-01-17 6:30 ` Nikolay Borisov
0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Borisov @ 2019-01-17 6:30 UTC (permalink / raw)
To: Qu Wenruo, linux-btrfs
On 17.01.19 г. 3:27 ч., Qu Wenruo wrote:
> 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 output for most distro.
>
> This patch will make the error message mandatory, so when problem
> happens we know what's causing the problem.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/disk-io.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 45bf6be9e751..d04ae6deba94 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -435,10 +435,10 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
> if (found_level != level) {
> #ifdef CONFIG_BTRFS_DEBUG
> WARN_ON(1);
> +#endif
> btrfs_err(fs_info,
> "tree level mismatch detected, bytenr=%llu level expected=%u has=%u",
> eb->start, level, found_level);
> -#endif
> return -EIO;
> }
>
> @@ -459,9 +459,10 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
> btrfs_item_key_to_cpu(eb, &found_key, 0);
> ret = btrfs_comp_cpu_keys(first_key, &found_key);
>
> -#ifdef CONFIG_BTRFS_DEBUG
> if (ret) {
> +#ifdef CONFIG_BTRFS_DEBUG
> WARN_ON(1);
> +#endif
Rather than WARN_ON(1) WARN() could be used, but that's something very
minor.
> btrfs_err(fs_info,
> "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,
> @@ -469,7 +470,6 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
> found_key.objectid, found_key.type,
> found_key.offset);
> }
> -#endif
> return ret;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-17 6:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 1:27 [PATCH] btrfs: Always output error message when key/level verification fails Qu Wenruo
2019-01-17 6:30 ` Nikolay Borisov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).