Skip to content

Commit ff326a3

Browse files
author
Al Viro
committed
open_last_lookups(): move complete_walk() into do_open()
Signed-off-by: Al Viro <[email protected]>
1 parent b94e0b3 commit ff326a3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

fs/namei.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,10 +3128,7 @@ static const char *open_last_lookups(struct nameidata *nd,
31283128
if (nd->last_type != LAST_NORM) {
31293129
if (nd->depth)
31303130
put_link(nd);
3131-
res = handle_dots(nd, nd->last_type);
3132-
if (likely(!res))
3133-
res = ERR_PTR(complete_walk(nd));
3134-
return res;
3131+
return handle_dots(nd, nd->last_type);
31353132
}
31363133

31373134
if (!(open_flag & O_CREAT)) {
@@ -3196,13 +3193,9 @@ static const char *open_last_lookups(struct nameidata *nd,
31963193
if (nd->depth)
31973194
put_link(nd);
31983195
res = step_into(nd, WALK_TRAILING, dentry, inode, seq);
3199-
if (unlikely(res)) {
3196+
if (unlikely(res))
32003197
nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL);
3201-
return res;
3202-
}
3203-
3204-
/* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
3205-
return ERR_PTR(complete_walk(nd));
3198+
return res;
32063199
}
32073200

32083201
/*
@@ -3216,6 +3209,11 @@ static int do_open(struct nameidata *nd,
32163209
int acc_mode;
32173210
int error;
32183211

3212+
if (!(file->f_mode & (FMODE_OPENED | FMODE_CREATED))) {
3213+
error = complete_walk(nd);
3214+
if (error)
3215+
return error;
3216+
}
32193217
if (!(file->f_mode & FMODE_CREATED))
32203218
audit_inode(nd->name, nd->path.dentry, 0);
32213219
if (open_flag & O_CREAT) {

0 commit comments

Comments
 (0)