]> git.neil.brown.name Git - LaFS.git/commitdiff
Ensure indexblock is clean when truncate finished.
authorNeilBrown <neilb@suse.de>
Thu, 10 Jun 2010 05:57:07 +0000 (15:57 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 13 Jun 2010 07:19:59 +0000 (17:19 +1000)
When truncate finishes and we are about to delete the inode,
we need to have the index block clean and unpinned so it can disappear
cleanly.
lafs_cluster_allocate nicely does this for us.

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

diff --git a/inode.c b/inode.c
index 6baf137838db691291526b1cd309a4947a7553a2..a837d44a0640fd156b5dbc029cbb02de98dfb640 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -743,7 +743,13 @@ void lafs_inode_handle_orphan(struct datablock *b)
        if (LAFSI(ino)->depth == 0) {
                /* Nothing to truncate */
                clear_bit(I_Trunc, &LAFSI(ino)->iflags);
-               lafs_iounlock_block(&ib->b);
+               if (test_bit(B_Pinned, &ib->b.flags))
+                       /* Need to move the dirtiness which keeps this
+                        * pinned to the data block.  
+                        */
+                       lafs_cluster_allocate(&ib->b, 0);
+               else
+                       lafs_iounlock_block(&ib->b);
                putiref(ib, MKREF(inode_handle_orphan3));
                goto restart;
        }