mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 02:16:45 +07:00
do_last(): merge the may_open() calls
have FMODE_OPENED case rejoin the main path at earlier point Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7be219b4dc
commit
3ad5615a07
10
fs/namei.c
10
fs/namei.c
@ -3207,10 +3207,7 @@ static const char *do_last(struct nameidata *nd,
|
|||||||
audit_inode(nd->name, file->f_path.dentry, 0);
|
audit_inode(nd->name, file->f_path.dentry, 0);
|
||||||
dput(nd->path.dentry);
|
dput(nd->path.dentry);
|
||||||
nd->path.dentry = dentry;
|
nd->path.dentry = dentry;
|
||||||
error = may_open(&nd->path, acc_mode, open_flag);
|
goto finish_open_created;
|
||||||
if (error)
|
|
||||||
goto out;
|
|
||||||
goto opened;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->f_mode & FMODE_CREATED) {
|
if (file->f_mode & FMODE_CREATED) {
|
||||||
@ -3277,11 +3274,10 @@ static const char *do_last(struct nameidata *nd,
|
|||||||
error = may_open(&nd->path, acc_mode, open_flag);
|
error = may_open(&nd->path, acc_mode, open_flag);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
BUG_ON(file->f_mode & FMODE_OPENED); /* once it's opened, it's opened */
|
if (!(file->f_mode & FMODE_OPENED))
|
||||||
error = vfs_open(&nd->path, file);
|
error = vfs_open(&nd->path, file);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
opened:
|
|
||||||
error = ima_file_check(file, op->acc_mode);
|
error = ima_file_check(file, op->acc_mode);
|
||||||
if (!error && will_truncate)
|
if (!error && will_truncate)
|
||||||
error = handle_truncate(file);
|
error = handle_truncate(file);
|
||||||
|
Loading…
Reference in New Issue
Block a user