Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: ufs: use ktime_get_real_ts64() for birthtime

CURRENT_TIME is not y2038 safe. Replace it with ktime_get_real_ts64().
Inode time formats are already 64 bit long and accommodates time64_t.

Link: http://lkml.kernel.org/r/1491613030-11599-6-git-send-email-deepa.kernel@gmail.com
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Deepa Dinamani and committed by
Linus Torvalds
a88e99e9 1134e091

+4 -2
+4 -2
fs/ufs/ialloc.c
··· 176 176 struct ufs_cg_private_info * ucpi; 177 177 struct ufs_cylinder_group * ucg; 178 178 struct inode * inode; 179 + struct timespec64 ts; 179 180 unsigned cg, bit, i, j, start; 180 181 struct ufs_inode_info *ufsi; 181 182 int err = -ENOSPC; ··· 324 323 lock_buffer(bh); 325 324 ufs2_inode = (struct ufs2_inode *)bh->b_data; 326 325 ufs2_inode += ufs_inotofsbo(inode->i_ino); 327 - ufs2_inode->ui_birthtime = cpu_to_fs64(sb, CURRENT_TIME.tv_sec); 328 - ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, CURRENT_TIME.tv_nsec); 326 + ktime_get_real_ts64(&ts); 327 + ufs2_inode->ui_birthtime = cpu_to_fs64(sb, ts.tv_sec); 328 + ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, ts.tv_nsec); 329 329 mark_buffer_dirty(bh); 330 330 unlock_buffer(bh); 331 331 if (sb->s_flags & MS_SYNCHRONOUS)