]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Fix btrfs_next_leaf to check for new items after dropping locks
authorChris Mason <chris.mason@oracle.com>
Wed, 25 Jun 2008 20:01:30 +0000 (16:01 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:03 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c

index 9601241e552b038bc1778057a329cd18bb6eea0d..b8f7aecf68d72de145ed8ce710b11dd5e1862855 100644 (file)
@@ -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;
        }