On Oct 7, 2020, at 2:13 AM, Jan Kara <jack@xxxxxxx> wrote: > > From: changfengnan <fengnanchang@xxxxxxxxxxx> > > When ext4 is formatted with lazy_journal_init=1 and transactions from > the previous filesystem are still on disk, it is possible that they are > considered during a recovery after a crash. Because the checksum seed > has changed, the CRC check will fail, and the journal recovery fails > with checksum error although the journal is otherwise perfectly valid. > Fix the problem by checking commit block time stamps to determine > whether the data in the journal block is just stale or whether it is > indeed corrupt. > > Reported-by: kernel test robot <lkp@xxxxxxxxx> > Signed-off-by: Fengnan Chang <changfengnan@xxxxxxxxxxxxx> > Signed-off-by: Jan Kara <jack@xxxxxxx> Reviewed-by: Andreas Dilger <adilger@xxxxxxxxx> NB: one trivial formatting cleanup if patch is refreshed > @@ -520,12 +522,22 @@ static int do_one_pass(journal_t *journal, > if (descr_csum_size > 0 && > !jbd2_descriptor_block_csum_verify(journal, > bh->b_data)) { > - printk(KERN_ERR "JBD2: Invalid checksum " > - "recovering block %lu in log\n", > - next_log_block); > - err = -EFSBADCRC; > - brelse(bh); > - goto failed; > + /* > + * PASS_SCAN can see stale blocks due to lazy > + * journal init. Don't error out on those yet. > + */ > + if (pass != PASS_SCAN) { > + pr_err("JBD2: Invalid checksum " > + "recovering block %lu in log\n", (style) should keep console message strings on a single line Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP