]> git.neil.brown.name Git - LaFS.git/commitdiff
Complete proper pinning dir_handle_orphans.
authorNeilBrown <neilb@suse.de>
Wed, 2 Sep 2009 00:55:20 +0000 (10:55 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 2 Sep 2009 00:55:20 +0000 (10:55 +1000)
If the orphan handler is going to dirty a block, it must
first pin it (and check for errors), and must afterwards remove
the PinPending.
One of the places which caused change did this.  The other didn't.

dir.c

diff --git a/dir.c b/dir.c
index bba9aa5df22b163984568f63ed200869be6d36bd..9f2991285dadebebf28c06e83a61d276fc961d64 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1330,11 +1330,15 @@ void lafs_dir_handle_orphan(struct datablock *b)
                        err = lafs_make_orphan_nb(fs, b2);
                unmap_dblock(b2, buf2);
                putdref(b2, MKREF(dir_orphan));
+               if (err)
+                       goto abort;
+               err = lafs_pin_dblock(b, ReleaseSpace);
                if (err)
                        goto abort;
                buf = map_dblock(b);
                lafs_dir_del_ent(buf, bits, seed, hash);
                lafs_dirty_dblock(b);
+               clear_bit(B_PinPending, &b->b.flags);
        }
 
        if (lafs_dir_empty(buf)) {