aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-01-16 10:09:44 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-02-03 18:35:04 -0500
commitef75c7974b383769ae5741cf930b8aa4dcaef395 (patch)
tree4ed78762d171e41badb94c1bca93ae0be3e5af16 /fs/nfs/dir.c
parentdf1d5d23d3a1a713c69b0f9ec67c59aeca3ce6b3 (diff)
NFS: Also use readdir info to revalidate positive dentries
If the fileid of the cached dentry fails to match that returned by the readdir call, then we should also d_drop. Try to take into account the fact that on NFSv4, readdir may return the "mounted_on_fileid" by looking for submounts. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index db29c7fa9620..062e108fac50 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1124,9 +1124,16 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
1124 name.hash = full_name_hash(name.name, name.len); 1124 name.hash = full_name_hash(name.name, name.len);
1125 dentry = d_lookup(parent, &name); 1125 dentry = d_lookup(parent, &name);
1126 if (dentry != NULL) { 1126 if (dentry != NULL) {
1127 /* Is this a positive dentry? */ 1127 /* Is this a positive dentry that matches the readdir info? */
1128 if (dentry->d_inode != NULL) 1128 if (dentry->d_inode != NULL &&
1129 return dentry; 1129 (NFS_FILEID(dentry->d_inode) == entry->ino ||
1130 d_mountpoint(dentry))) {
1131 if (!desc->plus || entry->fh->size == 0)
1132 return dentry;
1133 if (nfs_compare_fh(NFS_FH(dentry->d_inode),
1134 entry->fh) == 0)
1135 goto out_renew;
1136 }
1130 /* No, so d_drop to allow one to be created */ 1137 /* No, so d_drop to allow one to be created */
1131 d_drop(dentry); 1138 d_drop(dentry);
1132 dput(dentry); 1139 dput(dentry);
@@ -1152,6 +1159,7 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
1152 dentry = alias; 1159 dentry = alias;
1153 } 1160 }
1154 1161
1162out_renew:
1155 nfs_renew_times(dentry); 1163 nfs_renew_times(dentry);
1156 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1164 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1157 return dentry; 1165 return dentry;