Skip to content

Commit

Permalink
jbd2: fix infinite loop when recovering corrupt journal blocks
Browse files Browse the repository at this point in the history
When recovering the journal, don't fall into an infinite loop if we
encounter a corrupt journal block.  Instead, just skip the block and
return an error, which fails the mount and thus forces the user to run
a full filesystem fsck.

Signed-off-by: Darrick J. Wong <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Cc: [email protected]
  • Loading branch information
djwong authored and tytso committed Aug 29, 2014
1 parent 6603120 commit 022eaa7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/jbd2/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ static int do_one_pass(journal_t *journal,
int tag_bytes = journal_tag_bytes(journal);
__u32 crc32_sum = ~0; /* Transactional Checksums */
int descr_csum_size = 0;
int block_error = 0;

/*
* First thing is to establish what we expect to find in the log
Expand Down Expand Up @@ -598,7 +599,8 @@ static int do_one_pass(journal_t *journal,
"checksum recovering "
"block %llu in log\n",
blocknr);
continue;
block_error = 1;
goto skip_write;
}

/* Find a buffer for the new
Expand Down Expand Up @@ -797,7 +799,8 @@ static int do_one_pass(journal_t *journal,
success = -EIO;
}
}

if (block_error && success == 0)
success = -EIO;
return success;

failed:
Expand Down

0 comments on commit 022eaa7

Please sign in to comment.