lkml.org 
[lkml]   [2016]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 17/24] fs: ocfs2: Replace CURRENT_TIME with ktime_get_real_seconds()
    Date
    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.kernel@gmail.com>
    Cc: Mark Fasheh <mfasheh@suse.com>
    Cc: Joel Becker <jlbec@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
    \
     
     \ /
      Last update: 2016-06-26 00:21    [W:8.297 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site