]> git.neil.brown.name Git - LaFS.git/commitdiff
Wait for segment-scan to finish before unmount.
authorNeilBrown <neilb@suse.de>
Mon, 21 Jun 2010 00:19:25 +0000 (10:19 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 21 Jun 2010 00:29:33 +0000 (10:29 +1000)
It might be best to come up with a way to abort the scan,
but we won't want it to be running when we unmount, so wait
for it to complete and ensure it doesn't restart.

Signed-off-by: NeilBrown <neilb@suse.de>
checkpoint.c
segments.c
super.c

index cac045526dbaa78215028f466ffcf6304b06b21f..06c236e0881d39726a0c01f9597dbdc94a06384c 100644 (file)
@@ -453,13 +453,14 @@ static void finish_checkpoint(struct fs *fs, int youth)
        lafs_write_state(fs);
        dprintk("State written, all done %d\n", fs->seq);
 
-       fs->scan.done = 0;
+       if (!test_bit(CleanerDisabled, &fs->fsstate))
+               fs->scan.done = 0;
        fs->cleaner.cleaning = 0;
        /* FIXME should I wake someone up? */
        /* FIXME might I now be racing with unmount and module unload??? */
 
        fs->checkpoint_youth = youth;
-       wake_up(&fs->phase_wait);
+       lafs_wake_cleaner(fs);
 }
 
 unsigned long lafs_do_checkpoint(struct fs *fs)
index d6f3590dc5190ebee33917ff4f8646cee12568c6..4e2ae3a3c9cb1f069251f60bd3058d2528b82f2c 100644 (file)
@@ -1617,10 +1617,8 @@ unsigned long lafs_scan_seg(struct fs *fs)
                                fs->scan.trace = 0;
                                fs->total_free_prev = fs->total_free;
                                fs->total_free = 0;
-                               if (fs->scan.first_free_pass) {
-                                       fs->scan.first_free_pass = 0;
-                                       wake_up(&fs->phase_wait);
-                               }
+                               fs->scan.first_free_pass = 0;
+                               wake_up(&fs->phase_wait);
                                return MAX_SCHEDULE_TIMEOUT;
                        }
                }
diff --git a/super.c b/super.c
index 0428f8657693485d052613a1003b276676845520..da8d6ea76a5196172454658723b14e257a29719d 100644 (file)
--- a/super.c
+++ b/super.c
@@ -693,6 +693,7 @@ lafs_put_super(struct super_block *sb)
 
                wait_event(fs->async_complete,
                           list_empty(&fs->pending_orphans) &&
+                          fs->scan.done == 1 &&
                           fs->cleaner.active == 0);
                lafs_checkpoint_lock(fs);
                /* Don't incorporate any more segusage/quota updates. */