Commit 0a4eefbb authored by Yan Zheng's avatar Yan Zheng Committed by Chris Mason
Browse files

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: default avatarYan Zheng <>
Signed-off-by: default avatarChris Mason <>
parent 1fcbac58
......@@ -4296,10 +4296,10 @@ int btrfs_previous_item(struct btrfs_root *root,
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
if (found_key.type == type)
return 0;
if (found_key.objectid < min_objectid)
if (found_key.type == type)
return 0;
if (found_key.objectid == min_objectid &&
found_key.type < type)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment