nfs: ensure that attrcache is revalidated after a SETATTR
Subsystems (2)
PATCH 1/1 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.
--- fs/nfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/inode.c +4 -1
@@ -618,7 +618,10 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,nfs_inc_stats (inode,NFSIOS_SETATTRTRUNC );nfs_vmtruncate (inode, attr->ia_size); } -nfs_update_inode (inode, fattr); +if (fattr->valid) +nfs_update_inode (inode, fattr); +else +NFS_I (inode)->cache_validity |=NFS_INO_INVALID_ATTR ;spin_unlock (&inode->i_lock); }EXPORT_SYMBOL_GPL (nfs_setattr_update_inode);
Signature · 1 line
2.4.3
I tested it on a previously failing chmod/chattr/stat scenario (where client was relying on cached mode even though server didn't return post op attributes, and so reported an incorrect mode in stat) and it fixes that
Quoted 38 lines · Jeff Layton
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 <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- fs/nfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/nfs/inode.c +4
-2@@ -618,7 +618,10 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,nfs_inc_stats (inode,NFSIOS_SETATTRTRUNC );nfs_vmtruncate (inode, attr->ia_size); } -nfs_update_inode (inode, fattr); +if (fattr->valid) +nfs_update_inode (inode, fattr); +else +NFS_I (inode)->cache_validity |=NFS_INO_INVALID_ATTR ;spin_unlock (&inode->i_lock); }EXPORT_SYMBOL_GPL (nfs_setattr_update_inode); --2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Thanks, Steve