Commit 54ef4872 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro

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: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d58ffd35
...@@ -2209,13 +2209,23 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path, ...@@ -2209,13 +2209,23 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path,
int *want_write, bool *created) int *want_write, bool *created)
{ {
struct dentry *dir = nd->path.dentry; struct dentry *dir = nd->path.dentry;
struct inode *dir_inode = dir->d_inode;
struct dentry *dentry; struct dentry *dentry;
int error; int error;
bool need_lookup;
*created = false; *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)) if (IS_ERR(dentry))
return ERR_CAST(dentry); return ERR_CAST(dentry);
}
/* Negative dentry, just create the file */ /* Negative dentry, just create the file */
if (!dentry->d_inode && (op->open_flag & O_CREAT)) { if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment