nfs: treat open-associated setattr like write otc purposes
Subsystems (2)
PATCH 1/1 nfs: treat open-associated setattr like write otc purposes
From: "J. Bruce Fields" <[email protected]>
For the purposes of open-to-close cache consistency, I don't see why a setattr (if it's something like "ftruncate", that's associated with an open) should be treated any differently than a write.
In the v4 case (in the absence of pre-op attributes) that means we should fake up pre-op attributes as we do for write.
This allows us to handle reads from cache in more cases.
--- fs/nfs/inode.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
We discussed this a few weeks ago and you seemed amenable to the basic idea, but I have doubts about my implementation:
- Is this really the right place to do this?
- I'm changing v2/v3 behavior here too, where in the write case I think it's only v4 that does the nfs_post_op_update_inode_force_wcc().
Also cc'ing Bryan since I think you suggested he might be interested.
--b.
fs/nfs/inode.c +6 -1
@@ -438,8 +438,13 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)if ((attr->ia_valid & (ATTR_MODE |ATTR_UID |ATTR_GID )) !=0 )nfs_inode_return_delegation (inode); error =NFS_PROTO (inode)->setattr (dentry, fattr, attr); -if (error ==0 ) +if (error) + goto out_free; +if (attr->ia_valid &ATTR_FILE ) +nfs_post_op_update_inode_force_wcc (inode, fattr); +else nfs_refresh_inode (inode, fattr); +out_free:nfs_free_fattr (fattr); out:return error;
Signature · 1 line
1.7.5.4