diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2020-03-10 17:19:24 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-04-02 08:09:30 +0300 |
commit | ff326a3299660e46d4eb8876b217fee38638281a (patch) | |
tree | 1c1a38647905f2b05c423aa551acd97ca82d2576 /fs/namei.c | |
parent | b94e0b32c899914f045ddf05949517d64fd32499 (diff) | |
download | linux-ff326a3299660e46d4eb8876b217fee38638281a.tar.xz |
open_last_lookups(): move complete_walk() into do_open()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c index 2e9205599931..2c901a022faf 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3128,10 +3128,7 @@ static const char *open_last_lookups(struct nameidata *nd, if (nd->last_type != LAST_NORM) { if (nd->depth) put_link(nd); - res = handle_dots(nd, nd->last_type); - if (likely(!res)) - res = ERR_PTR(complete_walk(nd)); - return res; + return handle_dots(nd, nd->last_type); } if (!(open_flag & O_CREAT)) { @@ -3196,13 +3193,9 @@ finish_lookup: if (nd->depth) put_link(nd); res = step_into(nd, WALK_TRAILING, dentry, inode, seq); - if (unlikely(res)) { + if (unlikely(res)) nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL); - return res; - } - - /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ - return ERR_PTR(complete_walk(nd)); + return res; } /* @@ -3216,6 +3209,11 @@ static int do_open(struct nameidata *nd, int acc_mode; int error; + if (!(file->f_mode & (FMODE_OPENED | FMODE_CREATED))) { + error = complete_walk(nd); + if (error) + return error; + } if (!(file->f_mode & FMODE_CREATED)) audit_inode(nd->name, nd->path.dentry, 0); if (open_flag & O_CREAT) { |