[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <AF239FDD-1550-4D24-B2A4-C015689C9203@dilger.ca>
Date: Thu, 8 Oct 2020 14:13:02 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Jan Kara <jack@...e.cz>
Cc: Ted Tso <tytso@....edu>, linux-ext4@...r.kernel.org,
Fengnan Chang <changfengnan@...vision.com>,
changfengnan <fengnanchang@...mail.com>
Subject: Re: [PATCH v4] jbd2: avoid transaction reuse after reformatting
On Oct 7, 2020, at 2:13 AM, Jan Kara <jack@...e.cz> wrote:
>
> From: changfengnan <fengnanchang@...mail.com>
>
> 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@...el.com>
> Signed-off-by: Fengnan Chang <changfengnan@...vision.com>
> Signed-off-by: Jan Kara <jack@...e.cz>
Reviewed-by: Andreas Dilger <adilger@...ger.ca>
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
Download attachment "signature.asc" of type "application/pgp-signature" (874 bytes)
Powered by blists - more mailing lists