Re: [Y2038] [PATCH 06/20] fs: Fill in max and min timestamps in superblock
On Mon, Jul 29, 2019 at 06:49:10PM -0700, Deepa Dinamani wrote: > Fill in the appropriate limits to avoid inconsistencies > in the vfs cached inode times when timestamps are > outside the permitted range. > > Even though some filesystems are read-only, fill in the > timestamps to reflect the on-disk representation. > > Signed-off-by: Deepa Dinamani > Cc: aivazian.tig...@gmail.com > Cc: a...@alarsen.net > Cc: c...@cs.cmu.edu > Cc: darrick.w...@oracle.com > Cc: dushis...@mail.ru > Cc: dw...@infradead.org > Cc: h...@infradead.org > Cc: j...@suse.com > Cc: jahar...@cs.cmu.edu > Cc: lui...@kernel.org > Cc: n...@fluxnic.net > Cc: phil...@squashfs.org.uk > Cc: rich...@nod.at > Cc: salah.tr...@gmail.com > Cc: sha...@kernel.org > Cc: linux-...@vger.kernel.org > Cc: codal...@coda.cs.cmu.edu > Cc: linux-e...@vger.kernel.org > Cc: linux-...@lists.infradead.org > Cc: jfs-discuss...@lists.sourceforge.net > Cc: reiserfs-de...@vger.kernel.org > --- > fs/befs/linuxvfs.c | 2 ++ > fs/bfs/inode.c | 2 ++ > fs/coda/inode.c | 3 +++ > fs/cramfs/inode.c| 2 ++ > fs/efs/super.c | 2 ++ > fs/ext2/super.c | 2 ++ > fs/freevxfs/vxfs_super.c | 2 ++ > fs/jffs2/fs.c| 3 +++ > fs/jfs/super.c | 2 ++ > fs/minix/inode.c | 2 ++ > fs/qnx4/inode.c | 2 ++ > fs/qnx6/inode.c | 2 ++ > fs/reiserfs/super.c | 3 +++ > fs/romfs/super.c | 2 ++ > fs/squashfs/super.c | 2 ++ > fs/ufs/super.c | 7 +++ > fs/xfs/xfs_super.c | 2 ++ > 17 files changed, 42 insertions(+) > > diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c > index 462d096ff3e9..64cdf4d8e424 100644 > --- a/fs/befs/linuxvfs.c > +++ b/fs/befs/linuxvfs.c > @@ -893,6 +893,8 @@ befs_fill_super(struct super_block *sb, void *data, int > silent) > sb_set_blocksize(sb, (ulong) befs_sb->block_size); > sb->s_op = &befs_sops; > sb->s_export_op = &befs_export_operations; > + sb->s_time_min = 0; > + sb->s_time_max = 0xll; > root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir))); > if (IS_ERR(root)) { > ret = PTR_ERR(root); > diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c > index 5e97bed073d7..f8ce1368218b 100644 > --- a/fs/bfs/inode.c > +++ b/fs/bfs/inode.c > @@ -324,6 +324,8 @@ static int bfs_fill_super(struct super_block *s, void > *data, int silent) > return -ENOMEM; > mutex_init(&info->bfs_lock); > s->s_fs_info = info; > + s->s_time_min = 0; > + s->s_time_max = U32_MAX; > > sb_set_blocksize(s, BFS_BSIZE); > > diff --git a/fs/coda/inode.c b/fs/coda/inode.c > index 321f56e487cb..b1c70e2b9b1e 100644 > --- a/fs/coda/inode.c > +++ b/fs/coda/inode.c > @@ -188,6 +188,9 @@ static int coda_fill_super(struct super_block *sb, void > *data, int silent) > sb->s_magic = CODA_SUPER_MAGIC; > sb->s_op = &coda_super_operations; > sb->s_d_op = &coda_dentry_operations; > + sb->s_time_gran = 1; > + sb->s_time_min = S64_MIN; > + sb->s_time_max = S64_MAX; > > error = super_setup_bdi(sb); > if (error) > diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c > index 9352487bd0fc..4d1d8b7761ed 100644 > --- a/fs/cramfs/inode.c > +++ b/fs/cramfs/inode.c > @@ -597,6 +597,8 @@ static int cramfs_finalize_super(struct super_block *sb, > > /* Set it all up.. */ > sb->s_flags |= SB_RDONLY; > + sb->s_time_min = 0; > + sb->s_time_max = 0; > sb->s_op = &cramfs_ops; > root = get_cramfs_inode(sb, cramfs_root, 0); > if (IS_ERR(root)) > diff --git a/fs/efs/super.c b/fs/efs/super.c > index 867fc24dee20..4a6ebff2af76 100644 > --- a/fs/efs/super.c > +++ b/fs/efs/super.c > @@ -257,6 +257,8 @@ static int efs_fill_super(struct super_block *s, void *d, > int silent) > if (!sb) > return -ENOMEM; > s->s_fs_info = sb; > + s->s_time_min = 0; > + s->s_time_max = U32_MAX; > > s->s_magic = EFS_SUPER_MAGIC; > if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { > diff --git a/fs/ext2/super.c b/fs/ext2/super.c > index 44eb6e7eb492..baa36c6fb71e 100644 > --- a/fs/ext2/super.c > +++ b/fs/ext2/super.c > @@ -1002,6 +1002,8 @@ static int ext2_fill_super(struct super_block *sb, void > *data, int silent) > > sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); > sb->s_max_links = EXT2_LINK_MAX; > + sb->s_time_min = S32_MIN; > + sb->s_time_max = S32_MAX; > > if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) { > sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; > diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c > index a89f68c3cbed..578a5062706e 100644 > --- a/fs/freevxfs/vxfs_super.c > +++ b/fs/freevxfs/vxfs_super.c > @@ -229,6 +229,8 @@ static int vxfs_fill_super(struct super_block *sbp, void > *dp, int silent) > > sbp->s_op = &vxfs_super_ops; > sbp->s_fs_info = infp; > + sbp->s_time_min =
[Y2038] [PATCH 06/20] fs: Fill in max and min timestamps in superblock
Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Even though some filesystems are read-only, fill in the timestamps to reflect the on-disk representation. Signed-off-by: Deepa Dinamani Cc: aivazian.tig...@gmail.com Cc: a...@alarsen.net Cc: c...@cs.cmu.edu Cc: darrick.w...@oracle.com Cc: dushis...@mail.ru Cc: dw...@infradead.org Cc: h...@infradead.org Cc: j...@suse.com Cc: jahar...@cs.cmu.edu Cc: lui...@kernel.org Cc: n...@fluxnic.net Cc: phil...@squashfs.org.uk Cc: rich...@nod.at Cc: salah.tr...@gmail.com Cc: sha...@kernel.org Cc: linux-...@vger.kernel.org Cc: codal...@coda.cs.cmu.edu Cc: linux-e...@vger.kernel.org Cc: linux-...@lists.infradead.org Cc: jfs-discuss...@lists.sourceforge.net Cc: reiserfs-de...@vger.kernel.org --- fs/befs/linuxvfs.c | 2 ++ fs/bfs/inode.c | 2 ++ fs/coda/inode.c | 3 +++ fs/cramfs/inode.c| 2 ++ fs/efs/super.c | 2 ++ fs/ext2/super.c | 2 ++ fs/freevxfs/vxfs_super.c | 2 ++ fs/jffs2/fs.c| 3 +++ fs/jfs/super.c | 2 ++ fs/minix/inode.c | 2 ++ fs/qnx4/inode.c | 2 ++ fs/qnx6/inode.c | 2 ++ fs/reiserfs/super.c | 3 +++ fs/romfs/super.c | 2 ++ fs/squashfs/super.c | 2 ++ fs/ufs/super.c | 7 +++ fs/xfs/xfs_super.c | 2 ++ 17 files changed, 42 insertions(+) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 462d096ff3e9..64cdf4d8e424 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -893,6 +893,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) sb_set_blocksize(sb, (ulong) befs_sb->block_size); sb->s_op = &befs_sops; sb->s_export_op = &befs_export_operations; + sb->s_time_min = 0; + sb->s_time_max = 0xll; root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir))); if (IS_ERR(root)) { ret = PTR_ERR(root); diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 5e97bed073d7..f8ce1368218b 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -324,6 +324,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) return -ENOMEM; mutex_init(&info->bfs_lock); s->s_fs_info = info; + s->s_time_min = 0; + s->s_time_max = U32_MAX; sb_set_blocksize(s, BFS_BSIZE); diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 321f56e487cb..b1c70e2b9b1e 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -188,6 +188,9 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; sb->s_d_op = &coda_dentry_operations; + sb->s_time_gran = 1; + sb->s_time_min = S64_MIN; + sb->s_time_max = S64_MAX; error = super_setup_bdi(sb); if (error) diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 9352487bd0fc..4d1d8b7761ed 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -597,6 +597,8 @@ static int cramfs_finalize_super(struct super_block *sb, /* Set it all up.. */ sb->s_flags |= SB_RDONLY; + sb->s_time_min = 0; + sb->s_time_max = 0; sb->s_op = &cramfs_ops; root = get_cramfs_inode(sb, cramfs_root, 0); if (IS_ERR(root)) diff --git a/fs/efs/super.c b/fs/efs/super.c index 867fc24dee20..4a6ebff2af76 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c @@ -257,6 +257,8 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) if (!sb) return -ENOMEM; s->s_fs_info = sb; + s->s_time_min = 0; + s->s_time_max = U32_MAX; s->s_magic = EFS_SUPER_MAGIC; if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 44eb6e7eb492..baa36c6fb71e 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1002,6 +1002,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); sb->s_max_links = EXT2_LINK_MAX; + sb->s_time_min = S32_MIN; + sb->s_time_max = S32_MAX; if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) { sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index a89f68c3cbed..578a5062706e 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -229,6 +229,8 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) sbp->s_op = &vxfs_super_ops; sbp->s_fs_info = infp; + sbp->s_time_min = 0; + sbp->s_time_max = U32_MAX; if (!vxfs_try_sb_magic(sbp, silent, 1, (__force __fs32)cpu_to_le32(VXFS_SUPER_MAGIC))) { diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 8a20ddd25f2d..d0b59d03a7a9 100644 --- a/fs/jffs2/f