aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-06-05 09:10:16 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:33:02 -0400
commit54ef487241e863a6046536ac5b1fcd5d7cde86e5 (patch)
tree75b6ad7367e699ae891566a6b0d11d05b354ac94 /fs/namei.c
parentd58ffd35c1e595df2cf8ac4803f178c8be95ca7a (diff)
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>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index fad7117dbb28..ccb0eb17f528 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2209,14 +2209,24 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path,
2209 int *want_write, bool *created) 2209 int *want_write, bool *created)
2210{ 2210{
2211 struct dentry *dir = nd->path.dentry; 2211 struct dentry *dir = nd->path.dentry;
2212 struct inode *dir_inode = dir->d_inode;
2212 struct dentry *dentry; 2213 struct dentry *dentry;
2213 int error; 2214 int error;
2215 bool need_lookup;
2214 2216
2215 *created = false; 2217 *created = false;
2216 dentry = lookup_hash(nd); 2218 dentry = lookup_dcache(&nd->last, dir, nd, &need_lookup);
2217 if (IS_ERR(dentry)) 2219 if (IS_ERR(dentry))
2218 return ERR_CAST(dentry); 2220 return ERR_CAST(dentry);
2219 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 }
2229
2220 /* Negative dentry, just create the file */ 2230 /* Negative dentry, just create the file */
2221 if (!dentry->d_inode && (op->open_flag & O_CREAT)) { 2231 if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
2222 umode_t mode = op->mode; 2232 umode_t mode = op->mode;