Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df1d5d23d3a1a713c69b0f9ec67c59aeca3ce6b3
Commit:     df1d5d23d3a1a713c69b0f9ec67c59aeca3ce6b3
Parent:     ccfeb506231348a3c60ab0fdb5753a574653e3c0
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 15 13:56:29 2007 -0500
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Sat Feb 3 15:35:04 2007 -0800

    NFS: Fix a readdir/lookup inefficiency.
    
    Make sure that nfs_readdir_lookup() handles negative dentries correctly.
    If d_lookup() returns a negative dentry, then we need to d_drop() that
    since readdir shows that it should be positive.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/dir.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index bd269d2..db29c7f 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! */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to