[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211206143733.18918-1-lhenriques@suse.de>
Date: Mon, 6 Dec 2021 14:37:33 +0000
From: Luís Henriques <lhenriques@...e.de>
To: Theodore Ts'o <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>
Cc: linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
Luís Henriques <lhenriques@...e.de>,
Jeroen van Wolffelaar <jeroen@...ffelaar.nl>
Subject: [PATCH] ext4: set csum seed in tmp inode while migrating to extents
When migrating to extents, the temporary inode will have it's own checksum
seed. This means that, when swapping the inodes data, the inode checksums
will be incorrect.
This can be fixed by recalculating the extents checksums again. Or simply
by copying the seed into the temporary inode.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=213357
Reported-by: Jeroen van Wolffelaar <jeroen@...ffelaar.nl>
Signed-off-by: Luís Henriques <lhenriques@...e.de>
---
fs/ext4/migrate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index 7e0b4f81c6c0..dd4ece38fc83 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -413,7 +413,7 @@ int ext4_ext_migrate(struct inode *inode)
handle_t *handle;
int retval = 0, i;
__le32 *i_data;
- struct ext4_inode_info *ei;
+ struct ext4_inode_info *ei, *tmp_ei;
struct inode *tmp_inode = NULL;
struct migrate_struct lb;
unsigned long max_entries;
@@ -503,6 +503,10 @@ int ext4_ext_migrate(struct inode *inode)
}
ei = EXT4_I(inode);
+ tmp_ei = EXT4_I(tmp_inode);
+ /* Use the right seed for checksumming */
+ tmp_ei->i_csum_seed = ei->i_csum_seed;
+
i_data = ei->i_data;
memset(&lb, 0, sizeof(lb));
Powered by blists - more mailing lists