summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-06-05 15:10:14 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 16:33:00 +0400
commit7157486541bffc0dfec912e21ae639b029dae3d3 (patch)
tree67fb5de90ec7c05600935fa7b774265b7205b84b
parentb6183df7b294997a748eeb9991daa126986ead12 (diff)
downloadlinux-7157486541bffc0dfec912e21ae639b029dae3d3.tar.gz
linux-7157486541bffc0dfec912e21ae639b029dae3d3.tar.bz2
linux-7157486541bffc0dfec912e21ae639b029dae3d3.zip
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: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 12ed29712b4e..285e62e925f7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2250,30 +2250,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
symlink_ok = 1;
/* we _can_ be in RCU mode here */
error = lookup_fast(nd, &nd->last, path, &inode);
- if (unlikely(error)) {
- if (error < 0)
- 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 (likely(!error))
+ goto finish_lookup;
- if (error)
- nd->flags |= LOOKUP_JUMPED;
+ if (error < 0)
+ goto exit;
- inode = path->dentry->d_inode;
- }
- goto finish_lookup;
+ BUG_ON(nd->inode != dir->d_inode);
} else {
/* create side of things */
/*