[PATCH] NFSv4: Revalidate inode if any of its cache flags are dirty

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

 



If a file is opened on one host before it is renamed or unlinked on another,
an NFS 4.0 client will continue to use the original file handle. On some NFS
servers (e.g. Isilon), this can cause "Stale file errors" until the original
file is closed or the directory cache is refreshed.

Note that this problem does not occur with an NFS 4.1 client since the
revalidation will always occur because the NFS_CAP_ATOMIC_OPEN_V1 flag is
enabled.
---
 fs/nfs/dir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 8bfaa658b2c1..25259b0b41f9 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1626,6 +1626,9 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)
 	/* We cannot do exclusive creation on a positive dentry */
 	if (flags & LOOKUP_EXCL)
 		goto no_open;
+	/* Revalidate if any cache flags are dirty */
+	if (NFS_I(inode)->cache_validity)
+		goto no_open;
 
 	/* Let f_op->open() actually open (and revalidate) the file */
 	ret = 1;
-- 
2.16.2




[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