From: NeilBrown Date: Wed, 28 Jul 2010 11:59:08 +0000 (+1000) Subject: Make sure we do a cluster-flush when SecondFlushNeeded X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=84fcb012515b6df4149427181a85bb03a2154d88;p=LaFS.git Make sure we do a cluster-flush when SecondFlushNeeded 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 --- diff --git a/cluster.c b/cluster.c index cf43261..0bf1db5 100644 --- 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); }