linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH 1/1] nfs: open-associated setattr shouldn't invalidate own cache
@ 2011-10-27 19:09 Steve Dickson
  0 siblings, 0 replies; only message in thread
From: Steve Dickson @ 2011-10-27 19:09 UTC (permalink / raw)
  To: Linux NFS Mailing list

From: J. Bruce Fields <bfields@citi.umich.edu>

I'm not sure if this is really the right fix, but it seems silly to me
that e.g.

    open(O_RDWR|O_TRUNC)
    write()
    close()
    open(O_RDONLY)
    read()

results in an over-the-wire read (due to the setattr triggered by O_TRUNC).

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 fs/nfs/inode.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 385bc6d..5cdef63 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -429,8 +429,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;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-27 18:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 19:09 [RFC] [PATCH 1/1] nfs: open-associated setattr shouldn't invalidate own cache Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).