Commit af123b37 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Theodore Ts'o
Browse files

ext4: use 64-bit timestamps for mmp_time



The mmp_time field is 64 bits wide, which is good, but calling
get_seconds() results in a 32-bit value on 32-bit architectures. Using
ktime_get_real_seconds() instead returns 64 bits everywhere.

Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent a4d2aadc
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -147,7 +147,7 @@ static int kmmpd(void *data)


	mmp_block = le64_to_cpu(es->s_mmp_block);
	mmp_block = le64_to_cpu(es->s_mmp_block);
	mmp = (struct mmp_struct *)(bh->b_data);
	mmp = (struct mmp_struct *)(bh->b_data);
	mmp->mmp_time = cpu_to_le64(get_seconds());
	mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds());
	/*
	/*
	 * Start with the higher mmp_check_interval and reduce it if
	 * Start with the higher mmp_check_interval and reduce it if
	 * the MMP block is being updated on time.
	 * the MMP block is being updated on time.
@@ -165,7 +165,7 @@ static int kmmpd(void *data)
			seq = 1;
			seq = 1;


		mmp->mmp_seq = cpu_to_le32(seq);
		mmp->mmp_seq = cpu_to_le32(seq);
		mmp->mmp_time = cpu_to_le64(get_seconds());
		mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds());
		last_update_time = jiffies;
		last_update_time = jiffies;


		retval = write_mmp_block(sb, bh);
		retval = write_mmp_block(sb, bh);
@@ -241,7 +241,7 @@ static int kmmpd(void *data)
	 * Unmount seems to be clean.
	 * Unmount seems to be clean.
	 */
	 */
	mmp->mmp_seq = cpu_to_le32(EXT4_MMP_SEQ_CLEAN);
	mmp->mmp_seq = cpu_to_le32(EXT4_MMP_SEQ_CLEAN);
	mmp->mmp_time = cpu_to_le64(get_seconds());
	mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds());


	retval = write_mmp_block(sb, bh);
	retval = write_mmp_block(sb, bh);