From: Yan Zheng Date: Fri, 24 Jul 2009 15:06:53 +0000 (-0400) Subject: Btrfs: Fix ordering of key field checks in btrfs_previous_item X-Git-Tag: v2.6.31-rc5~7^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a4eefbb745ec0e8a5b694ae3f40cc34082d8f61;p=platform%2Fkernel%2Flinux-3.10.git 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 9157209..978449a 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;