lkml.org 
[lkml]   [2012]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/21] vfs: lookup_open(): expand lookup_hash()
Date
From: Miklos Szeredi <mszeredi@suse.cz>

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>
---
fs/namei.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 1153476..cd20ddc 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2200,14 +2200,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;
--
1.7.7


\
 
 \ /
  Last update: 2012-06-05 16:41    [W:0.179 / U:3.552 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site