Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Darrick J. Wong and committed by
Theodore Ts'o
022eaa75 6603120e

+5 -2
+5 -2
fs/jbd2/recovery.c
··· 426 426 int tag_bytes = journal_tag_bytes(journal); 427 427 __u32 crc32_sum = ~0; /* Transactional Checksums */ 428 428 int descr_csum_size = 0; 429 + int block_error = 0; 429 430 430 431 /* 431 432 * First thing is to establish what we expect to find in the log ··· 599 598 "checksum recovering " 600 599 "block %llu in log\n", 601 600 blocknr); 602 - continue; 601 + block_error = 1; 602 + goto skip_write; 603 603 } 604 604 605 605 /* Find a buffer for the new ··· 799 797 success = -EIO; 800 798 } 801 799 } 802 - 800 + if (block_error && success == 0) 801 + success = -EIO; 803 802 return success; 804 803 805 804 failed: