]> git.neil.brown.name Git - LaFS.git/commitdiff
unmount: clean up waiting for things.
authorNeilBrown <neilb@suse.de>
Fri, 18 Jun 2010 11:58:34 +0000 (21:58 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 18 Jun 2010 11:58:34 +0000 (21:58 +1000)
 The unmount thread should run any orphans.  That should be
 left to the cleaner thread.
 It might be useful to wait for the cleaner to finish up.
 An alternate might be to release all pending-for-clean blocks.

Signed-off-by: NeilBrown <neilb@suse.de>
clean.c
orphan.c
super.c

diff --git a/clean.c b/clean.c
index ad130314e92ec3d43b226e25de125bca8b5b8430..702d00ad7ae6f1b167ea8d917ce38d2e98a5b46f 100644 (file)
--- a/clean.c
+++ b/clean.c
@@ -599,8 +599,10 @@ static unsigned long do_clean(struct fs *fs)
                }
                if (doflush)
                        cleaner_flush(fs);
-               if (cnt == 0)
+               if (cnt == 0) {
                        fs->cleaner.active = 0;
+                       wake_up(&fs->async_complete);
+               }
        }
        return MAX_SCHEDULE_TIMEOUT;
 }
index 4fcaaae65584a037a50a9e319934ce7b011aea57..1387ef7b4bd4fa6c2bc1ecdde538fccb8f4d1693 100644 (file)
--- a/orphan.c
+++ b/orphan.c
@@ -505,7 +505,7 @@ long lafs_run_orphans(struct fs *fs)
        list_splice(&done, &fs->pending_orphans);
        spin_unlock(&fs->lock);
 
-       if (list_empty(&fs->pending_orphans))
+       if (list_empty_careful(&fs->pending_orphans))
                /* unmount might be waiting... */
                wake_up(&fs->async_complete);
        return MAX_SCHEDULE_TIMEOUT;
diff --git a/super.c b/super.c
index 7ef01fc5eac98911bef208f8d13344111e501f1b..b70d8e1e7b9b906819a85aa274971c8dc7094ad7 100644 (file)
--- a/super.c
+++ b/super.c
@@ -683,8 +683,13 @@ lafs_put_super(struct super_block *sb)
                /* This is the main sb, not a snapshot or
                 * subordinate fs
                 */
+               /* FIXME I'm not sure we should be waiting for the
+                * cleaner.  Maybe we should just release all tc->cleaning
+                * blocks instead.
+                */
                wait_event(fs->async_complete,
-                          (lafs_run_orphans(fs), list_empty(&fs->pending_orphans)));
+                          list_empty(&fs->pending_orphans) &&
+                          fs->cleaner.active == 0);
                lafs_checkpoint_lock(fs);
                /* Don't incorporate any more segusage/quota updates. */
                lafs_checkpoint_start(fs);