]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge branch 'vfs_timespec64' of https://github.com/deepa-hub/vfs into vfs-timespec64
authorArnd Bergmann <arnd@arndb.de>
Thu, 14 Jun 2018 12:51:13 +0000 (14:51 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 14 Jun 2018 12:54:00 +0000 (14:54 +0200)
Pull the timespec64 conversion from Deepa Dinamani:
 "The series aims to switch vfs timestamps to use
  struct timespec64. Currently vfs uses struct timespec,
  which is not y2038 safe.

  The flag patch applies cleanly. I've not seen the timestamps
  update logic change often. The series applies cleanly on 4.17-rc6
  and linux-next tip (top commit: next-20180517).

  I'm not sure how to merge this kind of a series with a flag patch.
  We are targeting 4.18 for this.
  Let me know if you have other suggestions.

  The series involves the following:
  1. Add vfs helper functions for supporting struct timepec64 timestamps.
  2. Cast prints of vfs timestamps to avoid warnings after the switch.
  3. Simplify code using vfs timestamps so that the actual
     replacement becomes easy.
  4. Convert vfs timestamps to use struct timespec64 using a script.
     This is a flag day patch.

  I've tried to keep the conversions with the script simple, to
  aid in the reviews. I've kept all the internal filesystem data
  structures and function signatures the same.

  Next steps:
  1. Convert APIs that can handle timespec64, instead of converting
     timestamps at the boundaries.
  2. Update internal data structures to avoid timestamp conversions."

I've pulled it into a branch based on top of the NFS changes that
are now in mainline, so I could resolve the non-obvious conflict
between the two while merging.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1  2 
fs/btrfs/inode.c
fs/cramfs/inode.c
fs/ext4/namei.c
fs/f2fs/namei.c
fs/jffs2/dir.c
fs/nfs/callback_proc.c
fs/nfs/inode.c
fs/nfs/nfs4xdr.c
fs/reiserfs/namei.c

Simple merge
Simple merge
diff --cc fs/ext4/namei.c
Simple merge
diff --cc fs/f2fs/namei.c
Simple merge
diff --cc fs/jffs2/dir.c
Simple merge
Simple merge
diff --cc fs/nfs/inode.c
index 73473d9bdfa499945540eda1296719646acc8cae,138941a97327d4ae96a70a4e973dcfeb764efa16..b65aee481d131d00734c057cd16f4532f2898211
@@@ -693,45 -679,13 +693,45 @@@ void nfs_setattr_update_inode(struct in
                        inode->i_uid = attr->ia_uid;
                if ((attr->ia_valid & ATTR_GID) != 0)
                        inode->i_gid = attr->ia_gid;
-                       inode->i_ctime = fattr->ctime;
 +              if (fattr->valid & NFS_ATTR_FATTR_CTIME)
++                      inode->i_ctime = timespec_to_timespec64(fattr->ctime);
 +              else
 +                      nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE
 +                                      | NFS_INO_INVALID_CTIME);
                nfs_set_cache_invalid(inode, NFS_INO_INVALID_ACCESS
                                | NFS_INO_INVALID_ACL);
        }
 -      if ((attr->ia_valid & ATTR_SIZE) != 0) {
 -              nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME);
 -              nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC);
 -              nfs_vmtruncate(inode, attr->ia_size);
 +      if (attr->ia_valid & (ATTR_ATIME_SET|ATTR_ATIME)) {
 +              NFS_I(inode)->cache_validity &= ~(NFS_INO_INVALID_ATIME
 +                              | NFS_INO_INVALID_CTIME);
 +              if (fattr->valid & NFS_ATTR_FATTR_ATIME)
-                       inode->i_atime = fattr->atime;
++                      inode->i_atime = timespec_to_timespec64(fattr->atime);
 +              else if (attr->ia_valid & ATTR_ATIME_SET)
 +                      inode->i_atime = attr->ia_atime;
 +              else
 +                      nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME);
 +
 +              if (fattr->valid & NFS_ATTR_FATTR_CTIME)
-                       inode->i_ctime = fattr->ctime;
++                      inode->i_ctime = timespec_to_timespec64(fattr->ctime);
 +              else
 +                      nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE
 +                                      | NFS_INO_INVALID_CTIME);
 +      }
 +      if (attr->ia_valid & (ATTR_MTIME_SET|ATTR_MTIME)) {
 +              NFS_I(inode)->cache_validity &= ~(NFS_INO_INVALID_MTIME
 +                              | NFS_INO_INVALID_CTIME);
 +              if (fattr->valid & NFS_ATTR_FATTR_MTIME)
-                       inode->i_mtime = fattr->mtime;
++                      inode->i_mtime = timespec_to_timespec64(fattr->mtime);
 +              else if (attr->ia_valid & ATTR_MTIME_SET)
 +                      inode->i_mtime = attr->ia_mtime;
 +              else
 +                      nfs_set_cache_invalid(inode, NFS_INO_INVALID_MTIME);
 +
 +              if (fattr->valid & NFS_ATTR_FATTR_CTIME)
-                       inode->i_ctime = fattr->ctime;
++                      inode->i_ctime = timespec_to_timespec64(fattr->ctime);
 +              else
 +                      nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE
 +                                      | NFS_INO_INVALID_CTIME);
        }
        if (fattr->valid)
                nfs_update_inode(inode, fattr);
@@@ -1394,11 -1351,10 +1398,11 @@@ static int nfs_check_inode_attributes(s
        struct nfs_inode *nfsi = NFS_I(inode);
        loff_t cur_size, new_isize;
        unsigned long invalid = 0;
+       struct timespec ts;
  
 -      if (nfs_have_delegated_attributes(inode))
 +      if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
                return 0;
 +
        /* Has the inode gone and changed behind our back? */
        if ((fattr->valid & NFS_ATTR_FATTR_FILEID) && nfsi->fileid != fattr->fileid)
                return -ESTALE;
Simple merge
Simple merge