vfs: nameidata_to_filp(): inline __dentry_open()
authorMiklos Szeredi <mszeredi@suse.cz>
Mon, 21 May 2012 15:30:17 +0000 (17:30 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Jun 2012 16:12:01 +0000 (12:12 -0400)
Copy __dentry_open() into nameidata_to_filp().

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c

index 511c548b0997c8d7ff7c3271bec8c17b1674344b..9fd34b76b9593bd0b3a2b280a8481f79215fabda 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -828,9 +828,25 @@ struct file *nameidata_to_filp(struct nameidata *nd)
 
        /* Has the filesystem initialised the file for us? */
        if (filp->f_path.dentry == NULL) {
+               struct file *res;
+
                path_get(&nd->path);
-               filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp,
-                                    NULL, cred);
+               res = do_dentry_open(nd->path.dentry, nd->path.mnt,
+                                    filp, NULL, cred);
+               if (!IS_ERR(res)) {
+                       int error;
+
+                       BUG_ON(res != filp);
+
+                       error = open_check_o_direct(filp);
+                       if (error) {
+                               fput(filp);
+                               filp = ERR_PTR(error);
+                       }
+               } else {
+                       put_filp(filp);
+                       filp = res;
+               }
        }
        return filp;
 }