summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-06-05 15:10:32 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 16:33:28 +0400
commita8277b9baa6268de386529a33061775bc716198b (patch)
treecdd127a78f7055b873ff79b2afdbb8d74382aac4
parentf60dc3db6e24b7c36445cf1feb56b34c799074b3 (diff)
vfs: move O_DIRECT check to common code
Perform open_check_o_direct() in a common place in do_last after opening the file. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 183a769537fe..4bc4bc6a6938 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2305,22 +2305,15 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
* here.
*/
error = may_open(&filp->f_path, acc_mode, open_flag);
- if (error)
- goto out_fput;
-
- error = open_check_o_direct(filp);
- if (error)
- goto out_fput;
+ if (error) {
+ fput(filp);
+ filp = ERR_PTR(error);
+ }
out:
dput(dentry);
return filp;
-out_fput:
- fput(filp);
- filp = ERR_PTR(error);
- goto out;
-
no_open:
if (need_lookup) {
dentry = lookup_real(dir, dentry, nd);
@@ -2619,10 +2612,10 @@ finish_open_created:
goto stale_open;
goto out;
}
+opened:
error = open_check_o_direct(filp);
if (error)
goto exit_fput;
-opened:
error = ima_file_check(filp, op->acc_mode);
if (error)
goto exit_fput;