aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-06-05 09:10:14 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:33:00 -0400
commit7157486541bffc0dfec912e21ae639b029dae3d3 (patch)
tree67fb5de90ec7c05600935fa7b774265b7205b84b /fs
parentb6183df7b294997a748eeb9991daa126986ead12 (diff)
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>
Diffstat (limited to 'fs')
-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,
2250 symlink_ok = 1; 2250 symlink_ok = 1;
2251 /* we _can_ be in RCU mode here */ 2251 /* we _can_ be in RCU mode here */
2252 error = lookup_fast(nd, &nd->last, path, &inode); 2252 error = lookup_fast(nd, &nd->last, path, &inode);
2253 if (unlikely(error)) { 2253 if (likely(!error))
2254 if (error < 0) 2254 goto finish_lookup;
2255 goto exit;
2256
2257 BUG_ON(nd->inode != dir->d_inode);
2258
2259 mutex_lock(&dir->d_inode->i_mutex);
2260 dentry = __lookup_hash(&nd->last, dir, nd);
2261 mutex_unlock(&dir->d_inode->i_mutex);
2262 error = PTR_ERR(dentry);
2263 if (IS_ERR(dentry))
2264 goto exit;
2265 path->mnt = nd->path.mnt;
2266 path->dentry = dentry;
2267 error = follow_managed(path, nd->flags);
2268 if (unlikely(error < 0))
2269 goto exit_dput;
2270 2255
2271 if (error) 2256 if (error < 0)
2272 nd->flags |= LOOKUP_JUMPED; 2257 goto exit;
2273 2258
2274 inode = path->dentry->d_inode; 2259 BUG_ON(nd->inode != dir->d_inode);
2275 }
2276 goto finish_lookup;
2277 } else { 2260 } else {
2278 /* create side of things */ 2261 /* create side of things */
2279 /* 2262 /*