Skip to contentSkip to conversation

nilfs2: use 64-bit superblock timstamps

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 20, 2018 – Jun 21, 2018 NILFS2 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nilfs2: use 64-bit superblock timstamps

The mount time field in the superblock uses a 64-bit timestamp, but calling get_seconds() may truncate the current time to 32 bits.

This changes it to ktime_get_real_seconds() to avoid the potential overflow.

---
 fs/nilfs2/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/super.c +1 -1
index 6ffeca84d7c3..1b9067cf4511 100644
@@ -834,7 +834,7 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount)
 		sbp[0]->s_max_mnt_count = cpu_to_le16(NILFS_DFL_MAX_MNT_COUNT);
 
 	sbp[0]->s_mnt_count = cpu_to_le16(mnt_count + 1);
-	sbp[0]->s_mtime = cpu_to_le64(get_seconds());
+	sbp[0]->s_mtime = cpu_to_le64(ktime_get_real_seconds());
 
 skip_mount_setup:
 	sbp[0]->s_state =
Signature · 6 lines
2.9.0

_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Arnd Bergmann

The mount time field in the superblock uses a 64-bit timestamp, but calling get_seconds() may truncate the current time to 32 bits.

This changes it to ktime_get_real_seconds() to avoid the potential overflow.

Looks good to me.

Thanks, all.

Quoted 10 lines
---
  fs/nilfs2/super.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/super.c +0 -0
index 6ffeca84d7c3..1b9067cf4511 100644

fs/nilfs2/super.c static int nilfs_setup_super(struct super_block *sb, int is_mount) · line 840

Quoted 8 lines
fs/nilfs2/super.c +1 -1
@@ -834,7 +834,7 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount)
  		sbp[0]->s_max_mnt_count = cpu_to_le16(NILFS_DFL_MAX_MNT_COUNT);
 
  	sbp[0]->s_mnt_count = cpu_to_le16(mnt_count + 1);
-	sbp[0]->s_mtime = cpu_to_le64(get_seconds());
+	sbp[0]->s_mtime = cpu_to_le64(ktime_get_real_seconds());
 
  skip_mount_setup:
  	sbp[0]->s_state =

_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038