aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-06-25 16:01:30 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:03 -0400
commit168fd7d271d9d8e81ff0b03eb08c36d82670c8a9 (patch)
tree147b1677446ba7a11ecc63a0364d33d378971fc0 /fs/btrfs/ctree.c
parent594a24eb0e7fa8413f8b443863be4b7c72bfde9f (diff)
downloadkernel_samsung_smdk4412-168fd7d271d9d8e81ff0b03eb08c36d82670c8a9.zip
kernel_samsung_smdk4412-168fd7d271d9d8e81ff0b03eb08c36d82670c8a9.tar.gz
kernel_samsung_smdk4412-168fd7d271d9d8e81ff0b03eb08c36d82670c8a9.tar.bz2
Fix btrfs_next_leaf to check for new items after dropping locks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-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 9601241..b8f7aec 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)
return ret;
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) {
+ path->slots[0]++;
goto done;
}