mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
Btrfs: fix up read_tree_block to return proper error
The return value of read_tree_block() can confuse callers as it always returns NULL for either -ENOMEM or -EIO, so it's likely that callers parse it to a wrong error, for instance, in btrfs_read_tree_root(). This fixes the above issue. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
8635eda91e
commit
64c043de46
5 changed files with 54 additions and 29 deletions
|
@ -491,7 +491,9 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
|
|||
BUG_ON(!ref->wanted_disk_byte);
|
||||
eb = read_tree_block(fs_info->tree_root, ref->wanted_disk_byte,
|
||||
0);
|
||||
if (!eb || !extent_buffer_uptodate(eb)) {
|
||||
if (IS_ERR(eb)) {
|
||||
return PTR_ERR(eb);
|
||||
} else if (!extent_buffer_uptodate(eb)) {
|
||||
free_extent_buffer(eb);
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -1034,7 +1036,10 @@ again:
|
|||
|
||||
eb = read_tree_block(fs_info->extent_root,
|
||||
ref->parent, 0);
|
||||
if (!eb || !extent_buffer_uptodate(eb)) {
|
||||
if (IS_ERR(eb)) {
|
||||
ret = PTR_ERR(eb);
|
||||
goto out;
|
||||
} else if (!extent_buffer_uptodate(eb)) {
|
||||
free_extent_buffer(eb);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue