summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-06-05 15:10:16 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 16:33:02 +0400
commit54ef487241e863a6046536ac5b1fcd5d7cde86e5 (patch)
tree75b6ad7367e699ae891566a6b0d11d05b354ac94
parentd58ffd35c1e595df2cf8ac4803f178c8be95ca7a (diff)
downloadlinux-54ef487241e863a6046536ac5b1fcd5d7cde86e5.tar.gz
linux-54ef487241e863a6046536ac5b1fcd5d7cde86e5.tar.bz2
linux-54ef487241e863a6046536ac5b1fcd5d7cde86e5.zip
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>
-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,
int *want_write, bool *created)
{
struct dentry *dir = nd->path.dentry;
+ struct inode *dir_inode = dir->d_inode;
struct dentry *dentry;
int error;
+ bool need_lookup;
*created = false;
- dentry = lookup_hash(nd);
+ dentry = lookup_dcache(&nd->last, dir, nd, &need_lookup);
if (IS_ERR(dentry))
return ERR_CAST(dentry);
+ if (need_lookup) {
+ BUG_ON(dentry->d_inode);
+
+ dentry = lookup_real(dir_inode, dentry, nd);
+ if (IS_ERR(dentry))
+ return ERR_CAST(dentry);
+ }
+
/* Negative dentry, just create the file */
if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
umode_t mode = op->mode;