Commit 168fd7d2 authored by Chris Mason's avatar Chris Mason

Fix btrfs_next_leaf to check for new items after dropping locks

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 594a24eb
...@@ -2999,7 +2999,14 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) ...@@ -2999,7 +2999,14 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
return ret; return ret;
nritems = btrfs_header_nritems(path->nodes[0]); nritems = btrfs_header_nritems(path->nodes[0]);
/*
* by releasing the path above we dropped all our locks. A balance
* could have added more items next to the key that used to be
* at the very end of the block. So, check again here and
* advance the path if there are now more items available.
*/
if (nritems > 0 && path->slots[0] < nritems - 1) { if (nritems > 0 && path->slots[0] < nritems - 1) {
path->slots[0]++;
goto done; goto done;
} }
......
Markdown is supported
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