diff options
author | Liu Bo <liub.liubo@gmail.com> | 2012-09-07 22:01:28 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-01 15:19:18 -0400 |
commit | 69917e431210f8712fe050f47b7561e7dae89521 (patch) | |
tree | 52a81d3c70d3a768d2d7756984dd16898ce12e50 /fs/btrfs/send.c | |
parent | dea7d76ecbfb53cda6aadd9bed33e87d255c5b02 (diff) |
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>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index e5c867996aa0..c6ef070a8dca 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -1152,6 +1152,7 @@ static int find_extent_clone(struct send_ctx *sctx, | |||
1152 | u64 disk_byte; | 1152 | u64 disk_byte; |
1153 | u64 num_bytes; | 1153 | u64 num_bytes; |
1154 | u64 extent_item_pos; | 1154 | u64 extent_item_pos; |
1155 | u64 flags = 0; | ||
1155 | struct btrfs_file_extent_item *fi; | 1156 | struct btrfs_file_extent_item *fi; |
1156 | struct extent_buffer *eb = path->nodes[0]; | 1157 | struct extent_buffer *eb = path->nodes[0]; |
1157 | struct backref_ctx *backref_ctx = NULL; | 1158 | struct backref_ctx *backref_ctx = NULL; |
@@ -1198,13 +1199,13 @@ static int find_extent_clone(struct send_ctx *sctx, | |||
1198 | } | 1199 | } |
1199 | logical = disk_byte + btrfs_file_extent_offset(eb, fi); | 1200 | logical = disk_byte + btrfs_file_extent_offset(eb, fi); |
1200 | 1201 | ||
1201 | ret = extent_from_logical(sctx->send_root->fs_info, | 1202 | ret = extent_from_logical(sctx->send_root->fs_info, disk_byte, tmp_path, |
1202 | disk_byte, tmp_path, &found_key); | 1203 | &found_key, &flags); |
1203 | btrfs_release_path(tmp_path); | 1204 | btrfs_release_path(tmp_path); |
1204 | 1205 | ||
1205 | if (ret < 0) | 1206 | if (ret < 0) |
1206 | goto out; | 1207 | goto out; |
1207 | if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | 1208 | if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { |
1208 | ret = -EIO; | 1209 | ret = -EIO; |
1209 | goto out; | 1210 | goto out; |
1210 | } | 1211 | } |