Skip to content

Commit c812012

Browse files
jtlaytontrondmypd
authored andcommitted
nfs: if we have no valid attrs, then don't declare the attribute cache valid
If we pass in an empty nfs_fattr struct to nfs_update_inode, it will (correctly) not update any of the attributes, but it then clears the NFS_INO_INVALID_ATTR flag, which indicates that the attributes are up to date. Don't clear the flag if the fattr struct has no valid attrs to apply. Reviewed-by: Steve French <steve.french@primarydata.com> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
1 parent 616c319 commit c812012

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

fs/nfs/inode.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
18271827
if ((long)fattr->gencount - (long)nfsi->attr_gencount > 0)
18281828
nfsi->attr_gencount = fattr->gencount;
18291829
}
1830-
invalid &= ~NFS_INO_INVALID_ATTR;
1830+
1831+
/* Don't declare attrcache up to date if there were no attrs! */
1832+
if (fattr->valid != 0)
1833+
invalid &= ~NFS_INO_INVALID_ATTR;
1834+
18311835
/* Don't invalidate the data if we were to blame */
18321836
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)
18331837
|| S_ISLNK(inode->i_mode)))

0 commit comments

Comments
 (0)