Simplify exec_permission_lite() logic
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Aug 2009 17:50:37 +0000 (10:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Sep 2009 18:07:43 +0000 (11:07 -0700)
Instead of returning EAGAIN and having the caller do something
special for that case,  just do the special case directly.

Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/namei.c

index a005d8b7afad7c941e79749261753e45493008bd..8c3580610eec721d34bccd391d0cdf0f10d28626 100644 (file)
@@ -435,7 +435,7 @@ static int exec_permission_lite(struct inode *inode)
        umode_t mode = inode->i_mode;
 
        if (inode->i_op->permission)
-               return -EAGAIN;
+               return inode_permission(inode, MAY_EXEC);
 
        if (current_fsuid() == inode->i_uid)
                mode >>= 6;
@@ -853,9 +853,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
 
                nd->flags |= LOOKUP_CONTINUE;
                err = exec_permission_lite(inode);
-               if (err == -EAGAIN)
-                       err = inode_permission(nd->path.dentry->d_inode,
-                                              MAY_EXEC);
                if (err)
                        break;