* [PATCH 4/4] Btrfs: fix wrong return value of btrfs_lookup_csum()
@ 2013-03-28 8:12 Miao Xie
0 siblings, 0 replies; only message in thread
From: Miao Xie @ 2013-03-28 8:12 UTC (permalink / raw)
To: Linux Btrfs
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>
---
fs/btrfs/file-item.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 9a447bc..bc89e2f 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -117,9 +117,11 @@ struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans,
csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]);
csums_in_item /= csum_size;
- if (csum_offset >= csums_in_item) {
+ if (csum_offset == csums_in_item) {
ret = -EFBIG;
goto fail;
+ } else if (csum_offset > csums_in_item) {
+ goto fail;
}
}
item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_csum_item);
--
1.8.0.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-03-28 8:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 8:12 [PATCH 4/4] Btrfs: fix wrong return value of btrfs_lookup_csum() Miao Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox