From 572fce6b24bbe9faaa5e9df798c257ac97a950e6 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 25 Jun 2010 20:29:34 +1000 Subject: [PATCH] Add loop-check to do_checkpoint If we cannot make adequate progress in do_checkpoint, as the root inode doesn't seem to be changing phase, report the status and abort. Signed-off-by: NeilBrown --- checkpoint.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/checkpoint.c b/checkpoint.c index 084db6b..9dff93c 100644 --- a/checkpoint.c +++ b/checkpoint.c @@ -365,6 +365,7 @@ static void do_checkpoint(void *data) struct fs *fs = data; int oldphase = !fs->phase; /*FIXME could there be a race getting this?*/ struct block *b; + int loops = 0; #ifdef DUMP dfs = fs; #endif @@ -419,9 +420,24 @@ static void do_checkpoint(void *data) if (test_bit(B_Pinned, &LAFSI(fs->ss[0].root)->iblock->b.flags) && !!test_bit(B_Phase1, &LAFSI(fs->ss[0].root)->iblock->b.flags) != fs->phase) { + + if (loops == 20) { + printk("Cannot escape PHASE=%d\n", oldphase); + lafs_print_tree(&LAFSI(fs->ss[0].root)->dblock->b, 0); + lafs_print_tree(&LAFSI(fs->ss[0].root)->iblock->b, 0); + lafs_trace = 1; + } + lafs_cluster_flush(fs, 0); lafs_cluster_wait_all(fs); lafs_clusters_done(fs); + if (loops == 20) { + printk("After cluster_flush...\n"); + lafs_print_tree(&LAFSI(fs->ss[0].root)->dblock->b, 0); + lafs_print_tree(&LAFSI(fs->ss[0].root)->iblock->b, 0); + BUG(); + } + loops++; goto again; } lafs_clusters_done(fs); -- 2.39.5