diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2014-05-29 17:59:57 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-10-10 18:11:32 +0200 |
commit | ed1b086a3042c25655233ece41ff97b8ecc73a35 (patch) | |
tree | 9b84dbe23db01bdb533b23014acd4a9ac63268dc /disk-io.c | |
parent | 8d2abcb6cc50762536fe04c50bf262f1ccf3b9a3 (diff) | |
download | btrfs-progs-ed1b086a3042c25655233ece41ff97b8ecc73a35.tar.gz |
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 'disk-io.c')
-rw-r--r-- | disk-io.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; |