]> git.neil.brown.name Git - LaFS.git/commitdiff
Make sure we do a cluster-flush when SecondFlushNeeded
authorNeilBrown <neilb@suse.de>
Wed, 28 Jul 2010 11:59:08 +0000 (21:59 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 9 Aug 2010 01:58:13 +0000 (11:58 +1000)
Also if FlushNeeded - normally this isn't needed as clhead won't be
empty, but there is room for races to make that not so - this is
safer.

So only test the FlushNeeded flags and ChecpointEnd for cnum==0,
ignore for the cleaner clusters.

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

index cf43261d18d63de758d84518b2f6d6e65d91c940..0bf1db5adcf025cffd3d2ab192816f2bb9356967 100644 (file)
--- a/cluster.c
+++ b/cluster.c
@@ -1382,8 +1382,12 @@ void lafs_cluster_flush(struct fs *fs, int cnum)
        dprintk("LAFS_cluster_flush %d\n", cnum);
        mutex_lock(&wc->lock);
        if (!list_empty(&wc->clhead)
-           || (fs->checkpointing & CH_CheckpointEnd)
-           || wc->chead_size > sizeof(struct cluster_head))
+           || wc->chead_size > sizeof(struct cluster_head)
+           || (cnum == 0 &&
+               ((fs->checkpointing & CH_CheckpointEnd)
+                || test_bit(FlushNeeded, &fs->fsstate)
+                || test_bit(SecondFlushNeeded, &fs->fsstate)
+                       )))
                cluster_flush(fs, cnum);
        mutex_unlock(&wc->lock);
 }