Commit 54ef487241e863a6046536ac5b1fcd5d7cde86e5

Authored by Miklos Szeredi
Committed by Al Viro
1 parent d58ffd35c1

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: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

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

... ... @@ -2209,13 +2209,23 @@
2209 2209 int *want_write, bool *created)
2210 2210 {
2211 2211 struct dentry *dir = nd->path.dentry;
  2212 + struct inode *dir_inode = dir->d_inode;
2212 2213 struct dentry *dentry;
2213 2214 int error;
  2215 + bool need_lookup;
2214 2216  
2215 2217 *created = false;
2216   - dentry = lookup_hash(nd);
  2218 + dentry = lookup_dcache(&nd->last, dir, nd, &need_lookup);
2217 2219 if (IS_ERR(dentry))
2218 2220 return ERR_CAST(dentry);
  2221 +
  2222 + if (need_lookup) {
  2223 + BUG_ON(dentry->d_inode);
  2224 +
  2225 + dentry = lookup_real(dir_inode, dentry, nd);
  2226 + if (IS_ERR(dentry))
  2227 + return ERR_CAST(dentry);
  2228 + }
2219 2229  
2220 2230 /* Negative dentry, just create the file */
2221 2231 if (!dentry->d_inode && (op->open_flag & O_CREAT)) {