lkml.org 
[lkml]   [2020]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH v4 67/69] open_last_lookups(): move complete_walk() into do_open()
Date
From: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/namei.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 3e1573373773..88ff59dcfd47 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3127,10 +3127,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)) {
@@ -3195,13 +3192,9 @@ static const char *open_last_lookups(struct nameidata *nd,
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;
}

/*
@@ -3215,6 +3208,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) {
--
2.11.0
\
 
 \ /
  Last update: 2020-03-14 00:54    [W:0.260 / U:5.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site