提交 ef75c797 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 df1d5d23
...@@ -1124,9 +1124,16 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) ...@@ -1124,9 +1124,16 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
name.hash = full_name_hash(name.name, name.len); name.hash = full_name_hash(name.name, name.len);
dentry = d_lookup(parent, &name); dentry = d_lookup(parent, &name);
if (dentry != NULL) { if (dentry != NULL) {
/* Is this a positive dentry? */ /* Is this a positive dentry that matches the readdir info? */
if (dentry->d_inode != NULL) if (dentry->d_inode != NULL &&
return dentry; (NFS_FILEID(dentry->d_inode) == entry->ino ||
d_mountpoint(dentry))) {
if (!desc->plus || entry->fh->size == 0)
return dentry;
if (nfs_compare_fh(NFS_FH(dentry->d_inode),
entry->fh) == 0)
goto out_renew;
}
/* No, so d_drop to allow one to be created */ /* No, so d_drop to allow one to be created */
d_drop(dentry); d_drop(dentry);
dput(dentry); dput(dentry);
...@@ -1152,6 +1159,7 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) ...@@ -1152,6 +1159,7 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
dentry = alias; dentry = alias;
} }
out_renew:
nfs_renew_times(dentry); nfs_renew_times(dentry);
nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
return dentry; return dentry;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册