]> git.baikalelectronics.ru Git - kernel.git/commit
jbd2: avoid transaction reuse after reformatting
authorchangfengnan <fengnanchang@foxmail.com>
Mon, 12 Oct 2020 16:49:00 +0000 (18:49 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 18 Oct 2020 14:37:26 +0000 (10:37 -0400)
commitc7c3d841df64516272fb56b2107ae4e3d52861a3
treece371bef7eb030cd6d334c7fdaf2737a574374fa
parenta5b845f13a73741c945f8c0dedf23147c20cfc33
jbd2: avoid transaction reuse after reformatting

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>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Fengnan Chang <changfengnan@hikvision.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20201012164900.20197-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/recovery.c