summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-08-08 11:16:42 +0200
committerChristian Brauner <brauner@kernel.org>2024-08-30 08:22:35 +0200
commit0f93bb54a3a502077bca4d7beb1fe2a90d3b59db (patch)
treedede0763a3948a34ff14251e37919a73edda61a6 /fs/namei.c
parentfs: remove audit dummy context check (diff)
downloadlinux-0f93bb54a3a502077bca4d7beb1fe2a90d3b59db.tar.xz
linux-0f93bb54a3a502077bca4d7beb1fe2a90d3b59db.zip
fs: rearrange general fastpath check now that O_CREAT uses it
If we find a positive dentry we can now simply try and open it. All prelimiary checks are already done with or without O_CREAT. Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 96c79dec7184..2699601bf8e9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3666,26 +3666,17 @@ static const char *open_last_lookups(struct nameidata *nd,
if (IS_ERR(dentry))
return ERR_CAST(dentry);
- if (!(open_flag & O_CREAT)) {
- if (likely(dentry))
- goto finish_lookup;
+ if (likely(dentry))
+ goto finish_lookup;
+ if (!(open_flag & O_CREAT)) {
if (WARN_ON_ONCE(nd->flags & LOOKUP_RCU))
return ERR_PTR(-ECHILD);
} else {
if (nd->flags & LOOKUP_RCU) {
- bool unlazied;
-
- /* can stay in rcuwalk if not auditing */
- if (dentry)
- goto finish_lookup;
- unlazied = dentry ? try_to_unlazy_next(nd, dentry) :
- try_to_unlazy(nd);
- if (!unlazied)
+ if (!try_to_unlazy(nd))
return ERR_PTR(-ECHILD);
}
- if (dentry)
- goto finish_lookup;
}
if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {