aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ctree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index f2a94999c371..ab4ac0365c7f 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2992,6 +2992,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
2992 struct extent_buffer *cur; 2992 struct extent_buffer *cur;
2993 struct btrfs_key found_key; 2993 struct btrfs_key found_key;
2994 int slot; 2994 int slot;
2995 int sret;
2995 u32 nritems; 2996 u32 nritems;
2996 int level; 2997 int level;
2997 int ret = 1; 2998 int ret = 1;
@@ -3009,7 +3010,7 @@ again:
3009 while(1) { 3010 while(1) {
3010 nritems = btrfs_header_nritems(cur); 3011 nritems = btrfs_header_nritems(cur);
3011 level = btrfs_header_level(cur); 3012 level = btrfs_header_level(cur);
3012 bin_search(cur, min_key, level, &slot); 3013 sret = bin_search(cur, min_key, level, &slot);
3013 3014
3014 /* at level = 0, we're done, setup the path and exit */ 3015 /* at level = 0, we're done, setup the path and exit */
3015 if (level == 0) { 3016 if (level == 0) {
@@ -3018,6 +3019,8 @@ again:
3018 btrfs_item_key_to_cpu(cur, &found_key, slot); 3019 btrfs_item_key_to_cpu(cur, &found_key, slot);
3019 goto out; 3020 goto out;
3020 } 3021 }
3022 if (sret && slot > 0)
3023 slot--;
3021 /* 3024 /*
3022 * check this node pointer against the cache_only and 3025 * check this node pointer against the cache_only and
3023 * min_trans parameters. If it isn't in cache or is too 3026 * min_trans parameters. If it isn't in cache or is too