From: Filipe Manana <fdmanana@kernel.org>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v5] btrfs: improve error reporting in lookup_inline_extent_backref
Date: Mon, 2 May 2022 10:30:28 +0100 [thread overview]
Message-ID: <Ym+ktE6Yrefhr39v@debian9.Home> (raw)
In-Reply-To: <20220429141734.866132-1-nborisov@suse.com>
On Fri, Apr 29, 2022 at 05:17:34PM +0300, Nikolay Borisov wrote:
> When iterating the backrefs in an extent item if the ptr to the
> 'current' backref record goes beyond the extent item a warning is
> generated and -ENOENT is returned. However what's more appropriate to
> debug such cases would be to return EUCLEAN and also print identifying
> information about the performed search as well as the current content of
> the leaf containing the possibly corrupted extent item.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Looks good now, thanks.
> ---
>
> V5:
> * Stop printing the key we are searching for as it was both wrong and redundant,
> since we have the slot number printed anyway. (Filipe)
>
> V4:
> * Also print the value of 'parent' as it's pertinent when metadata inline backrefs
> are being searched (Filipe)
> * Print the leaf before printing the error message so that the latter is
> not lost (Filipe)
>
> V3:
> * Fixed format for the btree slot
> * Removed redundant argument passed to format string
>
> fs/btrfs/extent-tree.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 963160a0c393..cca89016f2b3 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -895,7 +895,14 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
> err = -ENOENT;
> while (1) {
> if (ptr >= end) {
> - WARN_ON(ptr > end);
> + if (ptr > end) {
> + err = -EUCLEAN;
> + btrfs_print_leaf(path->nodes[0]);
> + btrfs_crit(fs_info,
> +"overrun extent record at slot %d while looking for inline extent for root %llu owner %llu offset %llu parent %llu",
> + path->slots[0], root_objectid, owner, offset,
> + parent);
> + }
> break;
> }
> iref = (struct btrfs_extent_inline_ref *)ptr;
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-05-02 9:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 14:17 [PATCH v5] btrfs: improve error reporting in lookup_inline_extent_backref Nikolay Borisov
2022-05-02 9:30 ` Filipe Manana [this message]
2022-05-02 18:31 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ym+ktE6Yrefhr39v@debian9.Home \
--to=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.