From 84fcb012515b6df4149427181a85bb03a2154d88 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 28 Jul 2010 21:59:08 +1000 Subject: [PATCH] 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 --- cluster.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); } -- 2.39.5