linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>,
	linux-ext4@vger.kernel.org,
	Fengnan Chang <changfengnan@hikvision.com>,
	changfengnan <fengnanchang@foxmail.com>
Subject: Re: [PATCH v4] jbd2: avoid transaction reuse after reformatting
Date: Thu, 8 Oct 2020 14:13:02 -0600	[thread overview]
Message-ID: <AF239FDD-1550-4D24-B2A4-C015689C9203@dilger.ca> (raw)
In-Reply-To: <20201007081319.16341-1-jack@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

On Oct 7, 2020, at 2:13 AM, Jan Kara <jack@suse.cz> wrote:
> 
> From: changfengnan <fengnanchang@foxmail.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@intel.com>
> Signed-off-by: Fengnan Chang <changfengnan@hikvision.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

Reviewed-by: Andreas Dilger <adilger@dilger.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






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

  reply	other threads:[~2020-10-08 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07  8:13 [PATCH v4] jbd2: avoid transaction reuse after reformatting Jan Kara
2020-10-08 20:13 ` Andreas Dilger [this message]
2020-10-09  2:16   ` Theodore Y. Ts'o
     [not found]     ` <tencent_909C05B896D07CD8BC84F2EC74B03A1A4007@qq.com>
2020-10-12 15:29       ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AF239FDD-1550-4D24-B2A4-C015689C9203@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=changfengnan@hikvision.com \
    --cc=fengnanchang@foxmail.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).