* [PATCH] NFS: allow close-to-open cache semantics to apply to root of NFS filesystem
@ 2010-05-28 10:39 Neil Brown
0 siblings, 0 replies; only message in thread
From: Neil Brown @ 2010-05-28 10:39 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs, Al Viro, Chuck Lever
To obey NFS cache semantics, the client must verify the cached
attributes when a file is opened. In most cases this is done by a call to
d_validate as one of the last steps in path_walk.
However for the root of a filesystem, d_validate is only ever called
on the mounted-on filesystem (except when the path ends '.' or '..').
So NFS has no chance to validate the attributes.
So, in nfs_opendir, we revalidate the attributes if the opened
directory is the mountpoint. This may cause double-validation for "."
and ".." lookups, but that is better than missing regular /path/name
lookups completely.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index ee9a179..72062da 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -140,6 +140,13 @@ nfs_opendir(struct inode *inode, struct file *filp)
/* Call generic open code in order to cache credentials */
res = nfs_open(inode, filp);
+ if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) {
+ /* This is a mountpoint, so d_revalidate will never
+ * have been called, so we need to refresh the
+ * inode (for close-open consistency) ourselves.
+ */
+ __nfs_revalidate_inode(NFS_SERVER(inode), inode);
+ }
return res;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-28 10:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28 10:39 [PATCH] NFS: allow close-to-open cache semantics to apply to root of NFS filesystem Neil Brown
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).