From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] libxfs: copy crtime correctly now that it's timespec64
Date: Wed, 5 May 2021 10:01:42 -0700 [thread overview]
Message-ID: <20210505170142.GC8582@magnolia> (raw)
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;
}
next reply other threads:[~2021-05-05 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 17:01 Darrick J. Wong [this message]
2021-05-06 6:39 ` [PATCH] libxfs: copy crtime correctly now that it's timespec64 Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210505170142.GC8582@magnolia \
--to=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox