Commit 7157486541bffc0dfec912e21ae639b029dae3d3

Authored by Miklos Szeredi
Committed by Al Viro
1 parent b6183df7b2

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>

Showing 1 changed file with 5 additions and 22 deletions Side-by-side Diff

... ... @@ -2250,30 +2250,13 @@
2250 2250 symlink_ok = 1;
2251 2251 /* we _can_ be in RCU mode here */
2252 2252 error = lookup_fast(nd, &nd->last, path, &inode);
2253   - if (unlikely(error)) {
2254   - if (error < 0)
2255   - goto exit;
  2253 + if (likely(!error))
  2254 + goto finish_lookup;
2256 2255  
2257   - BUG_ON(nd->inode != dir->d_inode);
  2256 + if (error < 0)
  2257 + goto exit;
2258 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   -
2271   - if (error)
2272   - nd->flags |= LOOKUP_JUMPED;
2273   -
2274   - inode = path->dentry->d_inode;
2275   - }
2276   - goto finish_lookup;
  2259 + BUG_ON(nd->inode != dir->d_inode);
2277 2260 } else {
2278 2261 /* create side of things */
2279 2262 /*