提交 4cb64024 编写于 作者: A Al Viro

lookup_fast(): don't bother with inode

Note that validation of ->d_seq after ->d_inode fetch is gone, along
with fetching of ->d_inode itself.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 b16c001d
...@@ -1621,8 +1621,7 @@ static struct dentry *__lookup_hash(const struct qstr *name, ...@@ -1621,8 +1621,7 @@ static struct dentry *__lookup_hash(const struct qstr *name,
return dentry; return dentry;
} }
static struct dentry *lookup_fast(struct nameidata *nd, static struct dentry *lookup_fast(struct nameidata *nd)
struct inode **inode)
{ {
struct dentry *dentry, *parent = nd->path.dentry; struct dentry *dentry, *parent = nd->path.dentry;
int status = 1; int status = 1;
...@@ -1640,22 +1639,11 @@ static struct dentry *lookup_fast(struct nameidata *nd, ...@@ -1640,22 +1639,11 @@ static struct dentry *lookup_fast(struct nameidata *nd,
return NULL; return NULL;
} }
/*
* This sequence count validates that the inode matches
* the dentry name information from lookup.
*/
*inode = d_backing_inode(dentry);
if (read_seqcount_retry(&dentry->d_seq, nd->next_seq))
return ERR_PTR(-ECHILD);
/* /*
* This sequence count validates that the parent had no * This sequence count validates that the parent had no
* changes while we did the lookup of the dentry above. * changes while we did the lookup of the dentry above.
*
* The memory barrier in read_seqcount_begin of child is
* enough, we can use __read_seqcount_retry here.
*/ */
if (__read_seqcount_retry(&parent->d_seq, nd->seq)) if (read_seqcount_retry(&parent->d_seq, nd->seq))
return ERR_PTR(-ECHILD); return ERR_PTR(-ECHILD);
status = d_revalidate(dentry, nd->flags); status = d_revalidate(dentry, nd->flags);
...@@ -1997,7 +1985,6 @@ static const char *handle_dots(struct nameidata *nd, int type) ...@@ -1997,7 +1985,6 @@ static const char *handle_dots(struct nameidata *nd, int type)
static const char *walk_component(struct nameidata *nd, int flags) static const char *walk_component(struct nameidata *nd, int flags)
{ {
struct dentry *dentry; struct dentry *dentry;
struct inode *inode;
/* /*
* "." and ".." are special - ".." especially so because it has * "." and ".." are special - ".." especially so because it has
* to be able to know about the current root directory and * to be able to know about the current root directory and
...@@ -2008,7 +1995,7 @@ static const char *walk_component(struct nameidata *nd, int flags) ...@@ -2008,7 +1995,7 @@ static const char *walk_component(struct nameidata *nd, int flags)
put_link(nd); put_link(nd);
return handle_dots(nd, nd->last_type); return handle_dots(nd, nd->last_type);
} }
dentry = lookup_fast(nd, &inode); dentry = lookup_fast(nd);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
return ERR_CAST(dentry); return ERR_CAST(dentry);
if (unlikely(!dentry)) { if (unlikely(!dentry)) {
...@@ -3396,7 +3383,6 @@ static const char *open_last_lookups(struct nameidata *nd, ...@@ -3396,7 +3383,6 @@ static const char *open_last_lookups(struct nameidata *nd,
struct dentry *dir = nd->path.dentry; struct dentry *dir = nd->path.dentry;
int open_flag = op->open_flag; int open_flag = op->open_flag;
bool got_write = false; bool got_write = false;
struct inode *inode;
struct dentry *dentry; struct dentry *dentry;
const char *res; const char *res;
...@@ -3412,7 +3398,7 @@ static const char *open_last_lookups(struct nameidata *nd, ...@@ -3412,7 +3398,7 @@ static const char *open_last_lookups(struct nameidata *nd,
if (nd->last.name[nd->last.len]) if (nd->last.name[nd->last.len])
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
/* we _can_ be in RCU mode here */ /* we _can_ be in RCU mode here */
dentry = lookup_fast(nd, &inode); dentry = lookup_fast(nd);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
return ERR_CAST(dentry); return ERR_CAST(dentry);
if (likely(dentry)) if (likely(dentry))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册