summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2016-12-12 19:41:26 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-12 21:55:06 -0500
commitc62c38f6b91b87a013bccd3637c2a1850d8e590c (patch)
tree5e76cc9fdd96e0db768bf77727b3d8fec4f8168f
parent395627b0718b6d4252c451c766cfc00ec155ddaf (diff)
ocfs2: replace CURRENT_TIME macro
CURRENT_TIME is not y2038 safe. Use y2038 safe ktime_get_real_seconds() here for timestamps. struct heartbeat_block's hb_seq and deletetion time are already 64 bits wide and accommodate times beyond y2038. Also use y2038 safe ktime_get_real_ts64() for on disk inode timestamps. These are also wide enough to accommodate time64_t. Link: http://lkml.kernel.org/r/1475365298-29236-1-git-send-email-deepa.kernel@gmail.com Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Cc: Mark Fasheh <mfasheh@versity.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Joseph Qi <jiangqi903@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ocfs2/cluster/heartbeat.c2
-rw-r--r--fs/ocfs2/inode.c2
-rw-r--r--fs/ocfs2/namei.c6
3 files changed, 6 insertions, 4 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 636abcbd4650..9158c9825094 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -741,7 +741,7 @@ static inline void o2hb_prepare_block(struct o2hb_region *reg,
741 hb_block = (struct o2hb_disk_heartbeat_block *)slot->ds_raw_block; 741 hb_block = (struct o2hb_disk_heartbeat_block *)slot->ds_raw_block;
742 memset(hb_block, 0, reg->hr_block_bytes); 742 memset(hb_block, 0, reg->hr_block_bytes);
743 /* TODO: time stuff */ 743 /* TODO: time stuff */
744 cputime = CURRENT_TIME.tv_sec; 744 cputime = ktime_get_real_seconds();
745 if (!cputime) 745 if (!cputime)
746 cputime = 1; 746 cputime = 1;
747 747
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index c56a7679df93..382401d3e88f 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -703,7 +703,7 @@ static int ocfs2_remove_inode(struct inode *inode,
703 goto bail_commit; 703 goto bail_commit;
704 } 704 }
705 705
706 di->i_dtime = cpu_to_le64(CURRENT_TIME.tv_sec); 706 di->i_dtime = cpu_to_le64(ktime_get_real_seconds());
707 di->i_flags &= cpu_to_le32(~(OCFS2_VALID_FL | OCFS2_ORPHANED_FL)); 707 di->i_flags &= cpu_to_le32(~(OCFS2_VALID_FL | OCFS2_ORPHANED_FL));
708 ocfs2_journal_dirty(handle, di_bh); 708 ocfs2_journal_dirty(handle, di_bh);
709 709
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 8d887c75765c..3b0a10d9b36f 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -516,6 +516,7 @@ static int __ocfs2_mknod_locked(struct inode *dir,
516 struct ocfs2_extent_list *fel; 516 struct ocfs2_extent_list *fel;
517 u16 feat; 517 u16 feat;
518 struct ocfs2_inode_info *oi = OCFS2_I(inode); 518 struct ocfs2_inode_info *oi = OCFS2_I(inode);
519 struct timespec64 ts;
519 520
520 *new_fe_bh = NULL; 521 *new_fe_bh = NULL;
521 522
@@ -564,10 +565,11 @@ static int __ocfs2_mknod_locked(struct inode *dir,
564 fe->i_last_eb_blk = 0; 565 fe->i_last_eb_blk = 0;
565 strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE); 566 strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE);
566 fe->i_flags |= cpu_to_le32(OCFS2_VALID_FL); 567 fe->i_flags |= cpu_to_le32(OCFS2_VALID_FL);
568 ktime_get_real_ts64(&ts);
567 fe->i_atime = fe->i_ctime = fe->i_mtime = 569 fe->i_atime = fe->i_ctime = fe->i_mtime =
568 cpu_to_le64(CURRENT_TIME.tv_sec); 570 cpu_to_le64(ts.tv_sec);
569 fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec = 571 fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec =
570 cpu_to_le32(CURRENT_TIME.tv_nsec); 572 cpu_to_le32(ts.tv_nsec);
571 fe->i_dtime = 0; 573 fe->i_dtime = 0;
572 574
573 /* 575 /*