Btrfs: fix a bug in parsing return value in logical resolve
In logical resolve, we parse extent_from_logical()'s 'ret' as a kind of flag. It is possible to lose our errors because (-EXXXX & BTRFS_EXTENT_FLAG_TREE_BLOCK) is true. I'm not sure if it is on purpose, it just looks too hacky if it is. I'd rather use a real flag and a 'ret' to catch errors. Acked-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Liu Bo <liub.liubo@gmail.com>
This commit is contained in:
@@ -1152,6 +1152,7 @@ static int find_extent_clone(struct send_ctx *sctx,
|
||||
u64 disk_byte;
|
||||
u64 num_bytes;
|
||||
u64 extent_item_pos;
|
||||
u64 flags = 0;
|
||||
struct btrfs_file_extent_item *fi;
|
||||
struct extent_buffer *eb = path->nodes[0];
|
||||
struct backref_ctx *backref_ctx = NULL;
|
||||
@@ -1198,13 +1199,13 @@ static int find_extent_clone(struct send_ctx *sctx,
|
||||
}
|
||||
logical = disk_byte + btrfs_file_extent_offset(eb, fi);
|
||||
|
||||
ret = extent_from_logical(sctx->send_root->fs_info,
|
||||
disk_byte, tmp_path, &found_key);
|
||||
ret = extent_from_logical(sctx->send_root->fs_info, disk_byte, tmp_path,
|
||||
&found_key, &flags);
|
||||
btrfs_release_path(tmp_path);
|
||||
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) {
|
||||
if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) {
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user