diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2016-12-05 17:07:53 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-12-14 15:21:26 +0100 |
commit | 0d8601ab6c7a73f025eeccf8e8ce3aa1cd2f3aa9 (patch) | |
tree | 4cf6a3df124ac7dd4190c18ff75a65ba382ac171 /cmds-check.c | |
parent | 71ffdb50eccf409f3f50389ca6f2057db105e0f2 (diff) |
btrfs-progs: check: Fix assert when using lowmem on fs with tree reloc tree
When using lowmem mode, btrfs check will report ASSERT for calling
btrfs_read_fs_root() on tree reloc tree.
Fix it by checking objectid and call btrfs_read_fs_root_no_cache() for
tree reloc tree.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-check.c')
-rw-r--r-- | cmds-check.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmds-check.c b/cmds-check.c index 34209b0a..2f7b1a8c 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -11387,7 +11387,11 @@ static int check_chunks_and_extents_v2(struct btrfs_root *root) goto next; key.offset = (u64)-1; - cur_root = btrfs_read_fs_root(root->fs_info, &key); + if (key.objectid == BTRFS_TREE_RELOC_OBJECTID) + cur_root = btrfs_read_fs_root_no_cache(root->fs_info, + &key); + else + cur_root = btrfs_read_fs_root(root->fs_info, &key); if (IS_ERR(cur_root) || !cur_root) { error("failed to read tree: %lld", key.objectid); goto next; @@ -11396,6 +11400,8 @@ static int check_chunks_and_extents_v2(struct btrfs_root *root) ret = traverse_tree_block(cur_root, cur_root->node); err |= ret; + if (key.objectid == BTRFS_TREE_RELOC_OBJECTID) + btrfs_free_fs_root(cur_root); next: ret = btrfs_next_item(root1, &path); if (ret) |