diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-03-28 04:12:15 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-03-28 09:51:31 -0400 |
commit | 82d130ff390be67d980d8b6f39e921c0b1d8d8e0 (patch) | |
tree | b9ad04b14f74ce072624b1f8a5ece4b9889187e1 /fs | |
parent | 39847c4d3d91f487f9ab3d083ee5d0f8419f105c (diff) |
Btrfs: fix wrong return value of btrfs_lookup_csum()
If we don't find the expected csum item, but find a csum item which is
adjacent to the specified extent, we should return -EFBIG, or we should
return -ENOENT. But btrfs_lookup_csum() return -EFBIG even the csum item
is not adjacent to the specified extent. Fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file-item.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index b7e529d2860f..c4628a201cb3 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -118,9 +118,11 @@ struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans, | |||
118 | csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]); | 118 | csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]); |
119 | csums_in_item /= csum_size; | 119 | csums_in_item /= csum_size; |
120 | 120 | ||
121 | if (csum_offset >= csums_in_item) { | 121 | if (csum_offset == csums_in_item) { |
122 | ret = -EFBIG; | 122 | ret = -EFBIG; |
123 | goto fail; | 123 | goto fail; |
124 | } else if (csum_offset > csums_in_item) { | ||
125 | goto fail; | ||
124 | } | 126 | } |
125 | } | 127 | } |
126 | item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); | 128 | item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item); |