From 5750e5f9246ead0bc2af7da0cb5bcdfc916cace6 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 12 Apr 2010 17:36:33 -0500 Subject: [PATCH] e2fsck: mark sparse journal as invalid For a filesystem that fails with: journal_bmap: journal block not found at offset 7334 on loop0 JBD: bad block at offset 7334 e2fsck won't actually fix this; it will mark the fs as clean, so it will mount, but it does not fix that block, and when the journal reaches this point again it will fail again. The following simple change to process_journal_block() might be a little drastic; it will clear & recreate the journal inode if it's sparse - i.e. if it gets block 0. I suppose we could be more complicated and try to replay the journal up to the error, but I'm not sure it's worth it since we're fscking it anyway. Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- e2fsck/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2fsck/journal.c b/e2fsck/journal.c index 155857d9..64a0fd62 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -214,7 +214,7 @@ static int process_journal_block(ext2_filsys fs, p = (struct process_block_struct *) priv_data; - if (blk < fs->super->s_first_data_block || + if (!blk || blk < fs->super->s_first_data_block || blk >= fs->super->s_blocks_count) return BLOCK_ABORT;