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.

Signed-off-by: Deepa Dinamani <deepa.ker...@gmail.com>
Cc: Mark Fasheh <mfas...@suse.com>
Cc: Joel Becker <jl...@evilplan.org>
Cc: ocfs2-devel@oss.oracle.com
---
 fs/ocfs2/cluster/heartbeat.c | 2 +-
 fs/ocfs2/inode.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 636abcb..9158c98 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,
        hb_block = (struct o2hb_disk_heartbeat_block *)slot->ds_raw_block;
        memset(hb_block, 0, reg->hr_block_bytes);
        /* TODO: time stuff */
-       cputime = CURRENT_TIME.tv_sec;
+       cputime = ktime_get_real_seconds();
        if (!cputime)
                cputime = 1;
 
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index c56a767..382401d 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -703,7 +703,7 @@ static int ocfs2_remove_inode(struct inode *inode,
                goto bail_commit;
        }
 
-       di->i_dtime = cpu_to_le64(CURRENT_TIME.tv_sec);
+       di->i_dtime = cpu_to_le64(ktime_get_real_seconds());
        di->i_flags &= cpu_to_le32(~(OCFS2_VALID_FL | OCFS2_ORPHANED_FL));
        ocfs2_journal_dirty(handle, di_bh);
 
-- 
1.9.1


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

Reply via email to