Skip to content

Commit 616c319

Browse files
jtlaytontrondmypd
authored andcommitted
nfs: ensure that attrcache is revalidated after a SETATTR
If we get no post-op attributes back from a SETATTR operation, then no attributes will of course be updated during the call to nfs_update_inode. We know however that the attributes are invalid at that point, since we just changed some of them. At the very least, the ctime will be bogus. If we get no post-op attributes back on the call, mark the attrcache invalid to reflect that fact. Reviewed-by: Steve French <steve.french@primarydata.com> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
1 parent 38b7631 commit 616c319

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/nfs/inode.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,10 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,
618618
nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC);
619619
nfs_vmtruncate(inode, attr->ia_size);
620620
}
621-
nfs_update_inode(inode, fattr);
621+
if (fattr->valid)
622+
nfs_update_inode(inode, fattr);
623+
else
624+
NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR;
622625
spin_unlock(&inode->i_lock);
623626
}
624627
EXPORT_SYMBOL_GPL(nfs_setattr_update_inode);

0 commit comments

Comments
 (0)