aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index bd269d26882..db29c7fa962 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1123,8 +1123,14 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
}
name.hash = full_name_hash(name.name, name.len);
dentry = d_lookup(parent, &name);
- if (dentry != NULL)
- return dentry;
+ if (dentry != NULL) {
+ /* Is this a positive dentry? */
+ if (dentry->d_inode != NULL)
+ return dentry;
+ /* No, so d_drop to allow one to be created */
+ d_drop(dentry);
+ dput(dentry);
+ }
if (!desc->plus || !(entry->fattr->valid & NFS_ATTR_FATTR))
return NULL;
/* Note: caller is already holding the dir->i_mutex! */