From: Anand Jain <anand.j...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to