aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2009-07-24 11:06:53 -0400
committerChris Mason <chris.mason@oracle.com>2009-07-24 11:22:47 -0400
commit0a4eefbb745ec0e8a5b694ae3f40cc34082d8f61 (patch)
treeb8c144c52f2725fa05325f282d8d2e4edc2e7181
parent1fcbac581be375ca0a686f72ee2b7fd1dbf386e7 (diff)
Btrfs: Fix ordering of key field checks in btrfs_previous_item
Check objectid of item before checking the item type, otherwise we may return zero for a key that is actually too low. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/ctree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 91572091c0a..978449af4cc 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -4296,10 +4296,10 @@ int btrfs_previous_item(struct btrfs_root *root,
path->slots[0]--;
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
- if (found_key.type == type)
- return 0;
if (found_key.objectid < min_objectid)
break;
+ if (found_key.type == type)
+ return 0;
if (found_key.objectid == min_objectid &&
found_key.type < type)
break;