]> git.neil.brown.name Git - LaFS.git/commitdiff
Add loop-check to do_checkpoint
authorNeilBrown <neilb@suse.de>
Fri, 25 Jun 2010 10:29:34 +0000 (20:29 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 27 Jun 2010 23:15:00 +0000 (09:15 +1000)
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 <neilb@suse.de>
checkpoint.c

index 084db6b247d73964348631c341f4dff070280052..9dff93c39795dbd051805440c3300932a899aaf2 100644 (file)
@@ -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);