Commit 78353ceb3c1e3526b2538188f4f005dbb07fd67c
Committed by
Greg Kroah-Hartman
1 parent
08dc1706c6
Exists in
ti-linux-3.14.y
and in
2 other branches
jbd2: fix infinite loop when recovering corrupt journal blocks
commit 022eaa7517017efe4f6538750c2b59a804dc7df7 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff
fs/jbd2/recovery.c
... | ... | @@ -426,6 +426,7 @@ |
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 |
... | ... | @@ -598,7 +599,8 @@ |
598 | 599 | "checksum recovering " |
599 | 600 | "block %llu in log\n", |
600 | 601 | blocknr); |
601 | - continue; | |
602 | + block_error = 1; | |
603 | + goto skip_write; | |
602 | 604 | } |
603 | 605 | |
604 | 606 | /* Find a buffer for the new |
... | ... | @@ -797,7 +799,8 @@ |
797 | 799 | success = -EIO; |
798 | 800 | } |
799 | 801 | } |
800 | - | |
802 | + if (block_error && success == 0) | |
803 | + success = -EIO; | |
801 | 804 | return success; |
802 | 805 | |
803 | 806 | failed: |