From: Filipe Manana <fdmanana@gmail.com>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: Don't panic when we can't find a root key
Date: Mon, 25 Feb 2019 09:57:12 +0000 [thread overview]
Message-ID: <CAL3q7H5cmpdeJ8o10ZHvShriSwNpCAxo1dbLbZHTEUXrZafsGQ@mail.gmail.com> (raw)
In-Reply-To: <20190225051106.22091-1-wqu@suse.com>
On Mon, Feb 25, 2019 at 5:12 AM Qu Wenruo <wqu@suse.com> wrote:
>
> When we failed to find a root key in btrfs_update_root(), we just panic.
>
> That's definitely not cool, fix it by aborting current transaction and
> return an error value.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Looks good.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
> ---
> fs/btrfs/root-tree.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
> index 65bda0682928..c48a3e18866d 100644
> --- a/fs/btrfs/root-tree.c
> +++ b/fs/btrfs/root-tree.c
> @@ -137,11 +137,15 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
> goto out;
> }
>
> - if (ret != 0) {
> + if (ret > 0) {
> btrfs_print_leaf(path->nodes[0]);
> - btrfs_crit(fs_info, "unable to update root key %llu %u %llu",
> - key->objectid, key->type, key->offset);
> - BUG_ON(1);
> + btrfs_crit(fs_info,
> + "unable to find root key (%llu %u %llu) in tree %llu",
> + key->objectid, key->type, key->offset,
> + root->root_key.objectid);
> + ret = -ENOENT;
> + btrfs_abort_transaction(trans, ret);
> + goto out;
> }
>
> l = path->nodes[0];
> --
> 2.20.1
>
--
Filipe David Manana,
“Whether you think you can, or you think you can't — you're right.”
next prev parent reply other threads:[~2019-02-25 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 5:11 [PATCH] btrfs: Don't panic when we can't find a root key Qu Wenruo
2019-02-25 9:57 ` Filipe Manana [this message]
2019-02-25 10:33 ` Johannes Thumshirn
2019-02-25 12:26 ` David Sterba
2019-02-25 12:47 ` Qu Wenruo
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=CAL3q7H5cmpdeJ8o10ZHvShriSwNpCAxo1dbLbZHTEUXrZafsGQ@mail.gmail.com \
--to=fdmanana@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@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;
as well as URLs for NNTP newsgroup(s).