提交 647f63bd 编写于 作者: F Filipe David Borba Manana 提交者: Chris Mason

Btrfs: add missing error checks to add_data_references

The function relocation.c:add_data_references() was not checking
if all calls to __add_tree_block() and find_data_references() were
succeeding or not.
Signed-off-by: NFilipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: NDavid Sterba <dsterba@suse.cz>
Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
Signed-off-by: NChris Mason <chris.mason@fusionio.com>
上级 ccf39f92
...@@ -3628,7 +3628,7 @@ int add_data_references(struct reloc_control *rc, ...@@ -3628,7 +3628,7 @@ int add_data_references(struct reloc_control *rc,
unsigned long ptr; unsigned long ptr;
unsigned long end; unsigned long end;
u32 blocksize = btrfs_level_size(rc->extent_root, 0); u32 blocksize = btrfs_level_size(rc->extent_root, 0);
int ret; int ret = 0;
int err = 0; int err = 0;
eb = path->nodes[0]; eb = path->nodes[0];
...@@ -3655,6 +3655,10 @@ int add_data_references(struct reloc_control *rc, ...@@ -3655,6 +3655,10 @@ int add_data_references(struct reloc_control *rc,
} else { } else {
BUG(); BUG();
} }
if (ret) {
err = ret;
goto out;
}
ptr += btrfs_extent_inline_ref_size(key.type); ptr += btrfs_extent_inline_ref_size(key.type);
} }
WARN_ON(ptr > end); WARN_ON(ptr > end);
...@@ -3700,6 +3704,7 @@ int add_data_references(struct reloc_control *rc, ...@@ -3700,6 +3704,7 @@ int add_data_references(struct reloc_control *rc,
} }
path->slots[0]++; path->slots[0]++;
} }
out:
btrfs_release_path(path); btrfs_release_path(path);
if (err) if (err)
free_block_list(blocks); free_block_list(blocks);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册