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>
This commit is contained in:
parent
f60dc3db6e
commit
a8277b9baa
1 changed files with 5 additions and 12 deletions
17
fs/namei.c
17
fs/namei.c
|
@ -2305,22 +2305,15 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
|
||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
error = may_open(&filp->f_path, acc_mode, open_flag);
|
error = may_open(&filp->f_path, acc_mode, open_flag);
|
||||||
if (error)
|
if (error) {
|
||||||
goto out_fput;
|
fput(filp);
|
||||||
|
filp = ERR_PTR(error);
|
||||||
error = open_check_o_direct(filp);
|
}
|
||||||
if (error)
|
|
||||||
goto out_fput;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
return filp;
|
return filp;
|
||||||
|
|
||||||
out_fput:
|
|
||||||
fput(filp);
|
|
||||||
filp = ERR_PTR(error);
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
no_open:
|
no_open:
|
||||||
if (need_lookup) {
|
if (need_lookup) {
|
||||||
dentry = lookup_real(dir, dentry, nd);
|
dentry = lookup_real(dir, dentry, nd);
|
||||||
|
@ -2619,10 +2612,10 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
|
||||||
goto stale_open;
|
goto stale_open;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
opened:
|
||||||
error = open_check_o_direct(filp);
|
error = open_check_o_direct(filp);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit_fput;
|
goto exit_fput;
|
||||||
opened:
|
|
||||||
error = ima_file_check(filp, op->acc_mode);
|
error = ima_file_check(filp, op->acc_mode);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit_fput;
|
goto exit_fput;
|
||||||
|
|
Loading…
Reference in a new issue