public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxfs: copy crtime correctly now that it's timespec64
@ 2021-05-05 17:01 Darrick J. Wong
  2021-05-06  6:39 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2021-05-05 17:01 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

From: Darrick J. Wong <djwong@kernel.org>

The incore i_mtime and di_crtime are both timespec64 now, which means
that tv_sec is a 64-bit value.  Don't cast that to int32_t when we're
creating an inode, because we'll end up truncating the creation time
incorrectly, should an xfsprogs of this vintage make it to 2039. :P

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 libxfs/util.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libxfs/util.c b/libxfs/util.c
index 1025ad24..a49aee9e 100644
--- a/libxfs/util.c
+++ b/libxfs/util.c
@@ -290,8 +290,7 @@ libxfs_init_new_inode(
 		VFS_I(ip)->i_version = 1;
 		ip->i_d.di_flags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 :
 				xfs_flags2diflags2(ip, fsx->fsx_xflags);
-		ip->i_d.di_crtime.tv_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec;
-		ip->i_d.di_crtime.tv_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec;
+		ip->i_d.di_crtime = VFS_I(ip)->i_mtime; /* struct copy */
 		ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize;
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-06  6:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-05 17:01 [PATCH] libxfs: copy crtime correctly now that it's timespec64 Darrick J. Wong
2021-05-06  6:39 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox