* [PATCH] NFSv4: Revalidate inode if any of its cache flags are dirty
@ 2018-09-27 18:14 Stan Hu
0 siblings, 0 replies; only message in thread
From: Stan Hu @ 2018-09-27 18:14 UTC (permalink / raw)
To: linux-nfs; +Cc: Stan Hu
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-09-28 0:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 18:14 [PATCH] NFSv4: Revalidate inode if any of its cache flags are dirty Stan Hu
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).