1 jbd2: fix infinite loop when recovering corrupt journal blocks
3 From: Darrick J. Wong <darrick.wong@oracle.com>
5 When recovering the journal, don't fall into an infinite loop if we
6 encounter a corrupt journal block. Instead, just skip the block and
7 return an error, which fails the mount and thus forces the user to run
8 a full filesystem fsck.
10 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 Cc: stable@vger.kernel.org
14 fs/jbd2/recovery.c | 7 +++++--
15 1 file changed, 5 insertions(+), 2 deletions(-)
17 diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
18 index 3b6bb19..00e9703 100644
19 --- a/fs/jbd2/recovery.c
20 +++ b/fs/jbd2/recovery.c
21 @@ -426,6 +426,7 @@ static int do_one_pass(journal_t *journal,
22 int tag_bytes = journal_tag_bytes(journal);
23 __u32 crc32_sum = ~0; /* Transactional Checksums */
24 int descr_csum_size = 0;
25 + int block_error = 0;
28 * First thing is to establish what we expect to find in the log
29 @@ -598,7 +599,8 @@ static int do_one_pass(journal_t *journal,
30 "checksum recovering "
31 "block %llu in log\n",
38 /* Find a buffer for the new
39 @@ -797,7 +799,8 @@ static int do_one_pass(journal_t *journal,
44 + if (block_error && success == 0)
51 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
52 the body of a message to majordomo@vger.kernel.org
53 More majordomo info at http://vger.kernel.org/majordomo-info.html