From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Improve error reporting in lookup_inline_extent_backref
Date: Wed, 20 Apr 2022 17:54:45 +0200 [thread overview]
Message-ID: <20220420155445.GH1513@twin.jikos.cz> (raw)
In-Reply-To: <20220420115401.186147-1-nborisov@suse.com>
On Wed, Apr 20, 2022 at 02:54:00PM +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 the in-memory
> state of the offending leaf.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent-tree.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 963160a0c393..5a53bcfdca83 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -895,7 +895,10 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
> err = -ENOENT;
> while (1) {
> if (ptr >= end) {
> - WARN_ON(ptr > end);
> + if (WARN_ON(ptr > end)) {
> + err = -EUCLEAN;
> + btrfs_print_leaf(path->slots[0]);
This gives a warning, the slots array does not contain the extent buffer
pointer so this should have been path->nodes[0] but this is already in
'leaf', fixed.
next prev parent reply other threads:[~2022-04-20 15:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 11:54 [PATCH] btrfs: Improve error reporting in lookup_inline_extent_backref Nikolay Borisov
2022-04-20 14:52 ` David Sterba
2022-04-22 10:11 ` Filipe Manana
2022-04-20 15:54 ` David Sterba [this message]
2022-04-20 16:01 ` Nikolay Borisov
2022-04-21 6:40 ` kernel test robot
2022-04-21 6:41 ` kernel test robot
2022-04-21 6:43 ` kernel test robot
2022-04-21 6:44 ` kernel test robot
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=20220420155445.GH1513@twin.jikos.cz \
--to=dsterba@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox