提交 022eaa75 编写于 作者: D Darrick J. Wong 提交者: Theodore Ts'o

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: NDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
上级 6603120e
...@@ -426,6 +426,7 @@ static int do_one_pass(journal_t *journal, ...@@ -426,6 +426,7 @@ static int do_one_pass(journal_t *journal,
int tag_bytes = journal_tag_bytes(journal); int tag_bytes = journal_tag_bytes(journal);
__u32 crc32_sum = ~0; /* Transactional Checksums */ __u32 crc32_sum = ~0; /* Transactional Checksums */
int descr_csum_size = 0; int descr_csum_size = 0;
int block_error = 0;
/* /*
* First thing is to establish what we expect to find in the log * 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, ...@@ -598,7 +599,8 @@ static int do_one_pass(journal_t *journal,
"checksum recovering " "checksum recovering "
"block %llu in log\n", "block %llu in log\n",
blocknr); blocknr);
continue; block_error = 1;
goto skip_write;
} }
/* Find a buffer for the new /* Find a buffer for the new
...@@ -797,7 +799,8 @@ static int do_one_pass(journal_t *journal, ...@@ -797,7 +799,8 @@ static int do_one_pass(journal_t *journal,
success = -EIO; success = -EIO;
} }
} }
if (block_error && success == 0)
success = -EIO;
return success; return success;
failed: failed:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册