]> git.neil.brown.name Git - LaFS.git/commitdiff
Ensure InoIdx block is really empty before erasing it.
authorNeilBrown <neilb@suse.de>
Wed, 23 Jun 2010 01:48:28 +0000 (11:48 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 23 Jun 2010 02:49:01 +0000 (12:49 +1000)
We we missing the test for non-empty children.
So move the block of code to after that test.

Signed-off-by: NeilBrown <neilb@suse.de>
modify.c

index 932d042b3f5c2aa9f2ca230f2ac2fa74511c6249..8521291047194f0b009ce578db8ab62b6b6c65a2 100644 (file)
--- a/modify.c
+++ b/modify.c
@@ -1820,21 +1820,6 @@ void lafs_incorporate(struct fs *fs, struct indexblock *ib)
         * children which are not EmptyIndex, we flag it
         * as EmptyIndex so index lookups know to avoid it.
         */
-       if (test_bit(B_InoIdx, &ib->b.flags)) {
-               /* Empty InoIdx blocks are allowed.  However depth must
-                * be 1.  This is where we suddenly collapse a now-empty
-                * indexing tree.
-                */
-               if ((ib->depth > 1 && lafs_index_empty(ib))) {
-                       ib->depth = 1;
-                       LAFSI(ib->b.inode)->depth = 1;
-                       lafs_clear_index(ib);
-               }
-               /* Don't need to dirty the inode - the fact that we just
-                * did incorporation should ensure it is already dirty
-                */
-               goto out2;
-       }
        if (ib->depth > 1 && ! lafs_index_empty(ib))
                goto out2;
        if (ib->depth > 1) {
@@ -1850,6 +1835,21 @@ void lafs_incorporate(struct fs *fs, struct indexblock *ib)
                if (non_empty)
                        goto out2;
        }
+       if (test_bit(B_InoIdx, &ib->b.flags)) {
+               /* Empty InoIdx blocks are allowed.  However depth must
+                * be 1.  This is where we suddenly collapse a now-empty
+                * indexing tree.
+                */
+               if (ib->depth > 1) {
+                       ib->depth = 1;
+                       LAFSI(ib->b.inode)->depth = 1;
+                       lafs_clear_index(ib);
+               }
+               /* Don't need to dirty the inode - the fact that we just
+                * did incorporation should ensure it is already dirty
+                */
+               goto out2;
+       }
        if (ib->depth == 1 &&
            (lafs_leaf_next(ib, 0) != 0xFFFFFFFF ||
             !list_empty(&ib->children)))