Skip to content

Commit 54ef487

Browse files
Miklos SzerediAl Viro
authored andcommitted
vfs: lookup_open(): expand lookup_hash()
Copy __lookup_hash() into lookup_open(). The next patch will insert the atomic open call just before the real lookup. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent d58ffd3 commit 54ef487

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fs/namei.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,14 +2209,24 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path,
22092209
int *want_write, bool *created)
22102210
{
22112211
struct dentry *dir = nd->path.dentry;
2212+
struct inode *dir_inode = dir->d_inode;
22122213
struct dentry *dentry;
22132214
int error;
2215+
bool need_lookup;
22142216

22152217
*created = false;
2216-
dentry = lookup_hash(nd);
2218+
dentry = lookup_dcache(&nd->last, dir, nd, &need_lookup);
22172219
if (IS_ERR(dentry))
22182220
return ERR_CAST(dentry);
22192221

2222+
if (need_lookup) {
2223+
BUG_ON(dentry->d_inode);
2224+
2225+
dentry = lookup_real(dir_inode, dentry, nd);
2226+
if (IS_ERR(dentry))
2227+
return ERR_CAST(dentry);
2228+
}
2229+
22202230
/* Negative dentry, just create the file */
22212231
if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
22222232
umode_t mode = op->mode;

0 commit comments

Comments
 (0)