Skip to content

Commit 022eaa7

Browse files
djwongtytso
authored andcommitted
jbd2: fix infinite loop when recovering corrupt journal blocks
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 <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org
1 parent 6603120 commit 022eaa7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎fs/jbd2/recovery.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ static int do_one_pass(journal_t *journal,
426426
int tag_bytes = journal_tag_bytes(journal);
427427
__u32 crc32_sum = ~0; /* Transactional Checksums */
428428
int descr_csum_size = 0;
429+
int block_error = 0;
429430

430431
/*
431432
* First thing is to establish what we expect to find in the log
@@ -598,7 +599,8 @@ static int do_one_pass(journal_t *journal,
598599
"checksum recovering "
599600
"block %llu in log\n",
600601
blocknr);
601-
continue;
602+
block_error = 1;
603+
goto skip_write;
602604
}
603605

604606
/* Find a buffer for the new
@@ -797,7 +799,8 @@ static int do_one_pass(journal_t *journal,
797799
success = -EIO;
798800
}
799801
}
800-
802+
if (block_error && success == 0)
803+
success = -EIO;
801804
return success;
802805

803806
failed:

0 commit comments

Comments
 (0)