提交 71574865 编写于 作者: M Miklos Szeredi 提交者: Al Viro

vfs: do_last(): common slow lookup

Make the slow lookup part of O_CREAT and non-O_CREAT opens common.

This allows atomic_open to be hooked into the slow lookup part.
Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 b6183df7
...@@ -2250,30 +2250,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path, ...@@ -2250,30 +2250,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
symlink_ok = 1; symlink_ok = 1;
/* we _can_ be in RCU mode here */ /* we _can_ be in RCU mode here */
error = lookup_fast(nd, &nd->last, path, &inode); error = lookup_fast(nd, &nd->last, path, &inode);
if (unlikely(error)) { if (likely(!error))
if (error < 0) goto finish_lookup;
goto exit;
BUG_ON(nd->inode != dir->d_inode);
mutex_lock(&dir->d_inode->i_mutex);
dentry = __lookup_hash(&nd->last, dir, nd);
mutex_unlock(&dir->d_inode->i_mutex);
error = PTR_ERR(dentry);
if (IS_ERR(dentry))
goto exit;
path->mnt = nd->path.mnt;
path->dentry = dentry;
error = follow_managed(path, nd->flags);
if (unlikely(error < 0))
goto exit_dput;
if (error) if (error < 0)
nd->flags |= LOOKUP_JUMPED; goto exit;
inode = path->dentry->d_inode; BUG_ON(nd->inode != dir->d_inode);
}
goto finish_lookup;
} else { } else {
/* create side of things */ /* create side of things */
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册