From: Anand jain <Anand.Jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: Anand Jain <anand.jain@oracle.com>
Subject: [PATCH] Seg fault when csum-tree root is corrupted.
Date: Tue, 3 Jul 2012 12:04:44 +0800 [thread overview]
Message-ID: <1341288284-2702-1-git-send-email-Anand.Jain@oracle.com> (raw)
In-Reply-To: <4FE95146.2030707@oracle.com>
From: Anand Jain <anand.jain@oracle.com>
Segmentation fault with the following trace when csum-tree is
deliberately corrupted using btrfs-corrupt-block
read block failed check_tree_block
Couldn't setup csum tree
checking extents
Check tree block failed, want=29376512, have=0
::
read block failed check_tree_block <---- !!
Segmentation fault (core dumped) <--- !!
The below fix will redirect btrfsck user to use --init-csum-tree
when csum root is corrupted
---
btrfsck.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/btrfsck.c b/btrfsck.c
index 7aac736..6ced7b5 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -3483,6 +3483,10 @@ int main(int ac, char **av)
fprintf(stderr, "Critical roots corrupted, unable to fsck the FS\n");
return -EIO;
}
+ if (!extent_buffer_uptodate(info->csum_root->node) && !init_csum_tree) {
+ fprintf(stderr, "Checksum root corrupted, run 'btrfsck --init-csum-tree'\n");
+ return -EIO;
+ }
root = info->fs_root;
--
1.7.1
prev parent reply other threads:[~2012-07-03 4:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 6:05 [Report] corrupted root csum tree result in segfault Anand Jain
2012-07-03 4:04 ` Anand jain [this message]
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=1341288284-2702-1-git-send-email-Anand.Jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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).