Skip to content

Commit 4cb6402

Browse files
author
Al Viro
committed
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: Al Viro <[email protected]>
1 parent b16c001 commit 4cb6402

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

fs/namei.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,8 +1621,7 @@ static struct dentry *__lookup_hash(const struct qstr *name,
16211621
return dentry;
16221622
}
16231623

1624-
static struct dentry *lookup_fast(struct nameidata *nd,
1625-
struct inode **inode)
1624+
static struct dentry *lookup_fast(struct nameidata *nd)
16261625
{
16271626
struct dentry *dentry, *parent = nd->path.dentry;
16281627
int status = 1;
@@ -1640,22 +1639,11 @@ static struct dentry *lookup_fast(struct nameidata *nd,
16401639
return NULL;
16411640
}
16421641

1643-
/*
1644-
* This sequence count validates that the inode matches
1645-
* the dentry name information from lookup.
1646-
*/
1647-
*inode = d_backing_inode(dentry);
1648-
if (read_seqcount_retry(&dentry->d_seq, nd->next_seq))
1649-
return ERR_PTR(-ECHILD);
1650-
16511642
/*
16521643
* This sequence count validates that the parent had no
16531644
* changes while we did the lookup of the dentry above.
1654-
*
1655-
* The memory barrier in read_seqcount_begin of child is
1656-
* enough, we can use __read_seqcount_retry here.
16571645
*/
1658-
if (__read_seqcount_retry(&parent->d_seq, nd->seq))
1646+
if (read_seqcount_retry(&parent->d_seq, nd->seq))
16591647
return ERR_PTR(-ECHILD);
16601648

16611649
status = d_revalidate(dentry, nd->flags);
@@ -1997,7 +1985,6 @@ static const char *handle_dots(struct nameidata *nd, int type)
19971985
static const char *walk_component(struct nameidata *nd, int flags)
19981986
{
19991987
struct dentry *dentry;
2000-
struct inode *inode;
20011988
/*
20021989
* "." and ".." are special - ".." especially so because it has
20031990
* 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)
20081995
put_link(nd);
20091996
return handle_dots(nd, nd->last_type);
20101997
}
2011-
dentry = lookup_fast(nd, &inode);
1998+
dentry = lookup_fast(nd);
20121999
if (IS_ERR(dentry))
20132000
return ERR_CAST(dentry);
20142001
if (unlikely(!dentry)) {
@@ -3396,7 +3383,6 @@ static const char *open_last_lookups(struct nameidata *nd,
33963383
struct dentry *dir = nd->path.dentry;
33973384
int open_flag = op->open_flag;
33983385
bool got_write = false;
3399-
struct inode *inode;
34003386
struct dentry *dentry;
34013387
const char *res;
34023388

@@ -3412,7 +3398,7 @@ static const char *open_last_lookups(struct nameidata *nd,
34123398
if (nd->last.name[nd->last.len])
34133399
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
34143400
/* we _can_ be in RCU mode here */
3415-
dentry = lookup_fast(nd, &inode);
3401+
dentry = lookup_fast(nd);
34163402
if (IS_ERR(dentry))
34173403
return ERR_CAST(dentry);
34183404
if (likely(dentry))

0 commit comments

Comments
 (0)