summaryrefslogtreecommitdiff
path: root/cmds-check.c
diff options
context:
space:
mode:
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>2014-05-29 17:59:57 +0800
committerDavid Sterba <dsterba@suse.cz>2014-10-10 18:11:32 +0200
commited1b086a3042c25655233ece41ff97b8ecc73a35 (patch)
tree9b84dbe23db01bdb533b23014acd4a9ac63268dc /cmds-check.c
parent8d2abcb6cc50762536fe04c50bf262f1ccf3b9a3 (diff)
Btrfs-progs: fsck: deal with corrupted csum root
If checksum root is corrupted, fsck will get segmentation. This is because if we fail to load checksum root, root's node is NULL which cause NULL pointer deferences later. To fix this problem, we just did something like extent tree rebuilding. Allocate a new one and clear uptodate flag. We will do sanity check before fsck going on. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-check.c')
-rw-r--r--cmds-check.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 7c5cfbb1..c0a9870e 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -6990,6 +6990,11 @@ int cmd_check(int argc, char **argv)
ret = -EIO;
goto close_out;
}
+ if (!extent_buffer_uptodate(info->csum_root->node)) {
+ fprintf(stderr, "Checksum root corrupted, rerun with --init-csum-tree option\n");
+ ret = -EIO;
+ goto close_out;
+ }
fprintf(stderr, "checking extents\n");
ret = check_chunks_and_extents(root);