NFS: Set the force revalidate flag if the inode is not completely initialised
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 27 Mar 2018 22:30:42 +0000 (18:30 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 31 May 2018 19:02:16 +0000 (15:02 -0400)
Ensure that a delegation doesn't cause us to skip initialising the inode
if it was incomplete when we exited nfs_fhget()

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/inode.c

index bd15d0b5762665b4f50be2c7a07c513b6891c635..40a6cf6db4e854528e31e84ce11bf93f82ec54ea 100644 (file)
@@ -448,6 +448,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
                /* We can't support update_atime(), since the server will reset it */
                inode->i_flags |= S_NOATIME|S_NOCMTIME;
                inode->i_mode = fattr->mode;
+               nfsi->cache_validity = 0;
                if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0
                                && nfs_server_capable(inode, NFS_CAP_MODE))
                        nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
@@ -534,6 +535,9 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
                        inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
                }
 
+               if (nfsi->cache_validity != 0)
+                       nfsi->cache_validity |= NFS_INO_REVAL_FORCED;
+
                nfs_setsecurity(inode, fattr, label);
 
                nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);