[PATCH] nfs: treat open-associated setattr like write otc purposes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "J. Bruce Fields" <bfields@xxxxxxxxxx>

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.

Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>
---
 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.

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index fe12037..b84748e 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -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;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux