summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds-check.c5
-rw-r--r--disk-io.c7
2 files changed, 12 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);
diff --git a/disk-io.c b/disk-io.c
index ed0b4626..5a2c49dc 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -909,6 +909,13 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
printk("Couldn't setup csum tree\n");
if (!(flags & OPEN_CTREE_PARTIAL))
return -EIO;
+ /* do the same thing as extent tree rebuilding */
+ fs_info->csum_root->node =
+ btrfs_find_create_tree_block(fs_info->extent_root, 0,
+ leafsize);
+ if (!fs_info->csum_root->node)
+ return -ENOMEM;
+ clear_extent_buffer_uptodate(NULL, fs_info->csum_root->node);
}
fs_info->csum_root->track_dirty = 1;