]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: recover csum seed of tmp_inode after migrating to extents
authorLi Lingfeng <lilingfeng3@huawei.com>
Fri, 17 Jun 2022 06:25:15 +0000 (14:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:17:59 +0000 (11:17 +0200)
commitd92ceea5277190082d2fc7bc579be9e80eea777e
tree1e0b0a443258180cd45e281702a2ee14fcd0c2c2
parent7c55843826a630b7f27cf87f234834ff0be7f9e8
ext4: recover csum seed of tmp_inode after migrating to extents

[ Upstream commit 3609731dd52c06b6eca15724ab3b7b07889dc3ad ]

When migrating to extents, the checksum seed of temporary inode
need to be replaced by inode's, otherwise the inode checksums
will be incorrect when swapping the inodes data.

However, the temporary inode can not match it's checksum to
itself since it has lost it's own checksum seed.

mkfs.ext4 -F /dev/sdc
mount /dev/sdc /mnt/sdc
xfs_io -fc "pwrite 4k 4k" -c "fsync" /mnt/sdc/testfile
chattr -e /mnt/sdc/testfile
chattr +e /mnt/sdc/testfile
umount /dev/sdc
fsck -fn /dev/sdc

========
...
Pass 1: Checking inodes, blocks, and sizes
Inode 13 passes checks, but checksum does not match inode.  Fix? no
...
========

The fix is simple, save the checksum seed of temporary inode, and
recover it after migrating to extents.

Fixes: 66a4d8deef8a ("ext4: set csum seed in tmp inode while migrating to extents")
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220617062515.2113438-1-lilingfeng3@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/migrate.c