From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Wang Shilong <wangsl.fnst@cn.fujitsu.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/4] Btrfs-progs: fsck: disallow partial opening if critical roots corrupted
Date: Mon, 6 Oct 2014 09:16:32 +0800 [thread overview]
Message-ID: <5431ED70.2040708@cn.fujitsu.com> (raw)
In-Reply-To: <1401276041-18349-2-git-send-email-wangsl.fnst@cn.fujitsu.com>
-------- Original Message --------
Subject: [PATCH 2/4] Btrfs-progs: fsck: disallow partial opening if
critical roots corrupted
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Date: 2014年05月28日 19:20
> If btrfs tree root is corrupted, fsck will hit the following segmentation.
>
> enabling repair mode
> Check tree block failed, want=29376512, have=0
> Check tree block failed, want=29376512, have=0
> Check tree block failed, want=29376512, have=0
> Check tree block failed, want=29376512, have=0
> Check tree block failed, want=29376512, have=0
> read block failed check_tree_block
> Couldn't read tree root
> Checking filesystem on /dev/sda9
> UUID: 0e1a754d-04a5-4256-ae79-0f769751803e
> Critical roots corrupted, unable to fsck the FS
> Segmentation fault (core dumped)
>
> In btrfs_setup_all_roots(), we could tolerate some trees(extent tree, csum tree)
> corrupted, and we have did careful check inside that function, it will
> return NULL if critial roots corrupt(for example tree root).
>
> The problem is that we check @OPEN_CTREE_PARTIAL flag again after
> calling btrfs_setup_all_roots() which will successfully return
> @fs_info though critial roots corrupted.
>
> Fix this problem by removing @OPEN_CTREE_PARTIAL flag check outsize
> btrfs_setup_all_roots().
>
> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> ---
> disk-io.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/disk-io.c b/disk-io.c
> index 58f3f07..63e153d 100644
> --- a/disk-io.c
> +++ b/disk-io.c
> @@ -1134,13 +1134,10 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
>
> ret = btrfs_setup_all_roots(fs_info, root_tree_bytenr, flags);
> if (ret)
> - goto out_failed;
> + goto out_chunk;
>
> return fs_info;
>
> -out_failed:
> - if (flags & OPEN_CTREE_PARTIAL)
> - return fs_info;
> out_chunk:
> btrfs_release_all_roots(fs_info);
> btrfs_cleanup_all_caches(fs_info);
Tested-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
This patch fixed a lot of segfault when checking fsfuzzed btrfs image.
Thanks,
Qu
next prev parent reply other threads:[~2014-10-06 1:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 11:20 [PATCH 1/4] Btrfs-progs: fsck: only allow partial opening under repair mode Wang Shilong
2014-05-28 11:20 ` [PATCH 2/4] Btrfs-progs: fsck: disallow partial opening if critical roots corrupted Wang Shilong
2014-10-06 1:16 ` Qu Wenruo [this message]
2014-05-28 11:20 ` [PATCH 3/4] Btrfs-progs: fsck: deal with corrupted csum root Wang Shilong
2014-05-28 11:20 ` [PATCH 4/4] Btrfs-progs: fsck: fix wrong check for btrfs_read_fs_root() Wang Shilong
2014-05-28 13:56 ` [PATCH 1/4] Btrfs-progs: fsck: only allow partial opening under repair mode Eric Sandeen
2014-05-28 14:10 ` Shilong Wang
2014-05-28 15:10 ` Eric Sandeen
2014-06-02 16:06 ` 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=5431ED70.2040708@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wangsl.fnst@cn.fujitsu.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.