diff options
| author | Neil Brown <neilb@suse.de> | 2010-08-10 10:20:05 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-08-10 10:20:05 -0400 |
| commit | f5a73672d1811f2fb1dcb62ca90ceb12b2050ae7 (patch) | |
| tree | f9d8798abbcbb6df399dea3d718ded7b2b2b5270 | |
| parent | 669502ff31d7dba1849aec7ee2450a3c61f57d39 (diff) | |
NFS: allow close-to-open cache semantics to apply to root of NFS filesystem
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>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | fs/nfs/dir.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 29539ceeb745..bd91b2778315 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -140,6 +140,13 @@ nfs_opendir(struct inode *inode, struct file *filp) | |||
| 140 | 140 | ||
| 141 | /* Call generic open code in order to cache credentials */ | 141 | /* Call generic open code in order to cache credentials */ |
| 142 | res = nfs_open(inode, filp); | 142 | res = nfs_open(inode, filp); |
| 143 | if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) { | ||
| 144 | /* This is a mountpoint, so d_revalidate will never | ||
| 145 | * have been called, so we need to refresh the | ||
| 146 | * inode (for close-open consistency) ourselves. | ||
| 147 | */ | ||
| 148 | __nfs_revalidate_inode(NFS_SERVER(inode), inode); | ||
| 149 | } | ||
| 143 | return res; | 150 | return res; |
| 144 | } | 151 | } |
| 145 | 152 | ||
