• Arnd Bergmann's avatar
    ocfs2: dlmglue: clean up timestamp handling · 3a3d1e51
    Arnd Bergmann authored
    The handling of timestamps outside of the 1970..2038 range in the dlm
    glue is rather inconsistent: on 32-bit architectures, this has always
    wrapped around to negative timestamps in the 1902..1969 range, while on
    64-bit kernels all timestamps are interpreted as positive 34 bit numbers
    in the 1970..2514 year range.
    
    Now that the VFS code handles 64-bit timestamps on all architectures, we
    can make the behavior more consistent here, and return the same result
    that we had on 64-bit already, making the file system y2038 safe in the
    process.  Outside of dlmglue, it already uses 64-bit on-disk timestamps
    anway, so that part is fine.
    
    For consistency, I'm changing ocfs2_pack_timespec() to clamp anything
    outside of the supported range to the minimum and maximum values.  This
    avoids a possible ambiguity of values before 1970 in particular, which
    used to be interpreted as times at the end of the 2514 range previously.
    
    Link: http://lkml.kernel.org/r/20180619155826.4106487-1-arnd@arndb.deSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Joseph Qi <jiangqi903@gmail.com>
    Cc: Changwei Ge <ge.changwei@h3c.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3a3d1e51
dlmglue.c 124 KB