Skip to content

Commit

Permalink
vfs: lookup_open(): expand lookup_hash()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Jul 14, 2012
1 parent d58ffd3 commit 54ef487
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,14 +2209,24 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path,
int *want_write, bool *created)
{
struct dentry *dir = nd->path.dentry;
struct inode *dir_inode = dir->d_inode;
struct dentry *dentry;
int error;
bool need_lookup;

*created = false;
dentry = lookup_hash(nd);
dentry = lookup_dcache(&nd->last, dir, nd, &need_lookup);
if (IS_ERR(dentry))
return ERR_CAST(dentry);

if (need_lookup) {
BUG_ON(dentry->d_inode);

dentry = lookup_real(dir_inode, dentry, nd);
if (IS_ERR(dentry))
return ERR_CAST(dentry);
}

/* Negative dentry, just create the file */
if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
umode_t mode = op->mode;
Expand Down

0 comments on commit 54ef487

Please sign in to comment.