[PATCH] ext4: set csum seed in tmp inode while migrating to extents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Signed-off-by: Luís Henriques <lhenriques@xxxxxxx>
---
 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));
 



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux