Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fb66a1989c8abc3015aa334f617658b277e5fe98
Commit:     fb66a1989c8abc3015aa334f617658b277e5fe98
Parent:     d7dd618a5901ce0b44ef518208b35f728775db74
Author:     Christoph Hellwig <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 04:04:32 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 10:23:06 2007 -0700

    knfsd: exportfs: move acceptable check into find_acceptable_alias
    
    All callers of find_acceptable_alias check if the current dentry is 
acceptable
    before looking for other acceptable aliases using find_acceptable_alias.  
Move
    the check into find_acceptable_alias to make the code a little more dense 
and
    add a comment to find_acceptable_alias that documents its intent.
    
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/exportfs/expfs.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index abf0a31..085d6c5 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -37,6 +37,9 @@ static int exportfs_get_name(struct dentry *dir, char *name,
                return get_name(dir, name, child);
 }
 
+/*
+ * Check if the dentry or any of it's aliases is acceptable.
+ */
 static struct dentry *
 find_acceptable_alias(struct dentry *result,
                int (*acceptable)(void *context, struct dentry *dentry),
@@ -44,6 +47,9 @@ find_acceptable_alias(struct dentry *result,
 {
        struct dentry *dentry, *toput = NULL;
 
+       if (acceptable(context, result))
+               return result;
+
        spin_lock(&dcache_lock);
        list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) {
                dget_locked(dentry);
@@ -126,9 +132,6 @@ find_exported_dentry(struct super_block *sb, void *obj, 
void *parent,
 
                target_dir = dget(result);
        } else {
-               if (acceptable(context, result))
-                       return result;
-
                alias = find_acceptable_alias(result, acceptable, context);
                if (alias)
                        return alias;
@@ -289,9 +292,6 @@ find_exported_dentry(struct super_block *sb, void *obj, 
void *parent,
                }
        }
        dput(target_dir);
-       /* now result is properly connected, it is our best bet */
-       if (acceptable(context, result))
-               return result;
 
        alias = find_acceptable_alias(result, acceptable, context);
        if (alias)
-
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