summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-19 12:42:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-19 12:42:37 -0400
commitcfb82e1df8b7c76991ea12958855897c2fb4debc (patch)
tree7419ef2cef9ec1ea43b78619af6ddd3471152a44 /fs/ext4/ext4.h
parentb41dae061bbd722b9d7fa828f35d22035b218e18 (diff)
parentcba465b4f9820b0d929822a70341dde14909fc18 (diff)
Merge tag 'y2038-vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground
Pull y2038 vfs updates from Arnd Bergmann: "Add inode timestamp clamping. This series from Deepa Dinamani adds a per-superblock minimum/maximum timestamp limit for a file system, and clamps timestamps as they are written, to avoid random behavior from integer overflow as well as having different time stamps on disk vs in memory. At mount time, a warning is now printed for any file system that can represent current timestamps but not future timestamps more than 30 years into the future, similar to the arbitrary 30 year limit that was added to settimeofday(). This was picked as a compromise to warn users to migrate to other file systems (e.g. ext4 instead of ext3) when they need the file system to survive beyond 2038 (or similar limits in other file systems), but not get in the way of normal usage" * tag 'y2038-vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground: ext4: Reduce ext4 timestamp warnings isofs: Initialize filesystem timestamp ranges pstore: fs superblock limits fs: omfs: Initialize filesystem timestamp ranges fs: hpfs: Initialize filesystem timestamp ranges fs: ceph: Initialize filesystem timestamp ranges fs: sysv: Initialize filesystem timestamp ranges fs: affs: Initialize filesystem timestamp ranges fs: fat: Initialize filesystem timestamp ranges fs: cifs: Initialize filesystem timestamp ranges fs: nfs: Initialize filesystem timestamp ranges ext4: Initialize timestamps limits 9p: Fill min and max timestamps in sb fs: Fill in max and min timestamps in superblock utimes: Clamp the timestamps before update mount: Add mount warning for impending timestamp expiry timestamp_truncate: Replace users of timespec64_trunc vfs: Add timestamp_truncate() api vfs: Add file timestamp range support
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 9c7f4036021b..42c6e4a5e673 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -832,11 +832,13 @@ static inline void ext4_decode_extra_time(struct timespec64 *time,
832 832
833#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ 833#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
834do { \ 834do { \
835 (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
836 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\ 835 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\
836 (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
837 (raw_inode)->xtime ## _extra = \ 837 (raw_inode)->xtime ## _extra = \
838 ext4_encode_extra_time(&(inode)->xtime); \ 838 ext4_encode_extra_time(&(inode)->xtime); \
839 } \ 839 } \
840 else \
841 (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (inode)->xtime.tv_sec, S32_MIN, S32_MAX)); \
840} while (0) 842} while (0)
841 843
842#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \ 844#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
@@ -1643,6 +1645,10 @@ static inline bool ext4_verity_in_progress(struct inode *inode)
1643 1645
1644#define EXT4_GOOD_OLD_INODE_SIZE 128 1646#define EXT4_GOOD_OLD_INODE_SIZE 128
1645 1647
1648#define EXT4_EXTRA_TIMESTAMP_MAX (((s64)1 << 34) - 1 + S32_MIN)
1649#define EXT4_NON_EXTRA_TIMESTAMP_MAX S32_MAX
1650#define EXT4_TIMESTAMP_MIN S32_MIN
1651
1646/* 1652/*
1647 * Feature set definitions 1653 * Feature set definitions
1648 */ 1654 */