aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ctree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 9601241e552b..b8f7aecf68d7 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2999,7 +2999,14 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
2999 return ret; 2999 return ret;
3000 3000
3001 nritems = btrfs_header_nritems(path->nodes[0]); 3001 nritems = btrfs_header_nritems(path->nodes[0]);
3002 /*
3003 * by releasing the path above we dropped all our locks. A balance
3004 * could have added more items next to the key that used to be
3005 * at the very end of the block. So, check again here and
3006 * advance the path if there are now more items available.
3007 */
3002 if (nritems > 0 && path->slots[0] < nritems - 1) { 3008 if (nritems > 0 && path->slots[0] < nritems - 1) {
3009 path->slots[0]++;
3003 goto done; 3010 goto done;
3004 } 3011 }
3005 3012