]> git.neil.brown.name Git - LaFS.git/commitdiff
Fix orphan flushing in rmdir
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)
lafs_dir_handle_orphan no longer requires drop_orphan,
and can drop the reference to the orphan block.
So we need to hold our own so we can test if it is still
and orphan after handling (in which case we must wait).

dir.c

diff --git a/dir.c b/dir.c
index d87f46a79e6b190c20e71def6684f96de511f1a6..bba9aa5df22b163984568f63ed200869be6d36bd 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -766,10 +766,14 @@ lafs_rmdir(struct inode *dir, struct dentry *de)
                struct datablock *db;
                DEFINE_WAIT(wq);
                while ((db = lafs_find_orphan(inode))) {
+                       int still_orphan;
                        prepare_to_wait(&fs->async_complete, &wq,
                                        TASK_UNINTERRUPTIBLE);
+                       getdref(db, MKREF(rmdir_orphan));
                        lafs_dir_handle_orphan(db);
-                       if (lafs_drop_orphan(fs, db) == 0)
+                       still_orphan = test_bit(B_Orphan, &db->b.flags);
+                       putdref(db, MKREF(rmdir_orphan));
+                       if (still_orphan)
                                /* still an orphan, need to wait */
                                schedule();
                }