Skip to content

Commit

Permalink
vfs: move O_DIRECT check to common code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Jul 14, 2012
1 parent f60dc3d commit a8277b9
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -2619,10 +2612,10 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
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;
Expand Down

0 comments on commit a8277b9

Please sign in to comment.