From: NeilBrown Date: Mon, 21 Jun 2010 00:19:25 +0000 (+1000) Subject: Wait for segment-scan to finish before unmount. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=9f77b59a851d952397e9bc4cb474ce976f8a7b50;p=LaFS.git Wait for segment-scan to finish before unmount. 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 --- diff --git a/checkpoint.c b/checkpoint.c index cac0455..06c236e 100644 --- a/checkpoint.c +++ b/checkpoint.c @@ -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) diff --git a/segments.c b/segments.c index d6f3590..4e2ae3a 100644 --- a/segments.c +++ b/segments.c @@ -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 0428f86..da8d6ea 100644 --- 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. */