summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-08-17 09:59:07 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-09-15 20:52:41 -0700
commitf93e5436f0ee5a85eaa3a86d2614d215873fb18b (patch)
treece60a83ad06e42b199e2ebb14fa62e33be7f6955 /fs/xfs/scrub
parent30e05599219f3c15bd5f24190af0e33cdb4a00e5 (diff)
xfs: widen ondisk inode timestamps to deal with y2038+
Redesign the ondisk inode timestamps to be a simple unsigned 64-bit counter of nanoseconds since 14 Dec 1901 (i.e. the minimum time in the 32-bit unix time epoch). This enables us to handle dates up to 2486, which solves the y2038 problem. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Gao Xiang <hsiangkao@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub')
-rw-r--r--fs/xfs/scrub/inode.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c
index eb1cc013d4ca..3aa85b64de36 100644
--- a/fs/xfs/scrub/inode.c
+++ b/fs/xfs/scrub/inode.c
@@ -190,6 +190,11 @@ xchk_inode_flags2(
if ((flags2 & XFS_DIFLAG2_DAX) && (flags2 & XFS_DIFLAG2_REFLINK))
goto bad;
+ /* no bigtime iflag without the bigtime feature */
+ if (xfs_dinode_has_bigtime(dip) &&
+ !xfs_sb_version_hasbigtime(&mp->m_sb))
+ goto bad;
+
return;
bad:
xchk_ino_set_corrupt(sc, ino);
@@ -199,11 +204,12 @@ static inline void
xchk_dinode_nsec(
struct xfs_scrub *sc,
xfs_ino_t ino,
+ struct xfs_dinode *dip,
const xfs_timestamp_t ts)
{
struct timespec64 tv;
- tv = xfs_inode_from_disk_ts(ts);
+ tv = xfs_inode_from_disk_ts(dip, ts);
if (tv.tv_nsec < 0 || tv.tv_nsec >= NSEC_PER_SEC)
xchk_ino_set_corrupt(sc, ino);
}
@@ -306,9 +312,9 @@ xchk_dinode(
}
/* di_[amc]time.nsec */
- xchk_dinode_nsec(sc, ino, dip->di_atime);
- xchk_dinode_nsec(sc, ino, dip->di_mtime);
- xchk_dinode_nsec(sc, ino, dip->di_ctime);
+ xchk_dinode_nsec(sc, ino, dip, dip->di_atime);
+ xchk_dinode_nsec(sc, ino, dip, dip->di_mtime);
+ xchk_dinode_nsec(sc, ino, dip, dip->di_ctime);
/*
* di_size. xfs_dinode_verify checks for things that screw up
@@ -413,7 +419,7 @@ xchk_dinode(
}
if (dip->di_version >= 3) {
- xchk_dinode_nsec(sc, ino, dip->di_crtime);
+ xchk_dinode_nsec(sc, ino, dip, dip->di_crtime);
xchk_inode_flags2(sc, dip, ino, mode, flags, flags2);
xchk_inode_cowextsize(sc, dip, ino, mode, flags,
flags2);