mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 05:13:18 +00:00
follow_dotdot{,_rcu}(): don't bother with inode
step_into() will fetch it, TYVM. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
a4f5b52167
commit
b16c001de0
15
fs/namei.c
15
fs/namei.c
@ -1884,8 +1884,7 @@ static const char *step_into(struct nameidata *nd, int flags,
|
|||||||
return pick_link(nd, &path, inode, flags);
|
return pick_link(nd, &path, inode, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dentry *follow_dotdot_rcu(struct nameidata *nd,
|
static struct dentry *follow_dotdot_rcu(struct nameidata *nd)
|
||||||
struct inode **inodep)
|
|
||||||
{
|
{
|
||||||
struct dentry *parent, *old;
|
struct dentry *parent, *old;
|
||||||
|
|
||||||
@ -1909,7 +1908,6 @@ static struct dentry *follow_dotdot_rcu(struct nameidata *nd,
|
|||||||
}
|
}
|
||||||
old = nd->path.dentry;
|
old = nd->path.dentry;
|
||||||
parent = old->d_parent;
|
parent = old->d_parent;
|
||||||
*inodep = parent->d_inode;
|
|
||||||
nd->next_seq = read_seqcount_begin(&parent->d_seq);
|
nd->next_seq = read_seqcount_begin(&parent->d_seq);
|
||||||
// makes sure that non-RCU pathwalk could reach this state
|
// makes sure that non-RCU pathwalk could reach this state
|
||||||
if (read_seqcount_retry(&old->d_seq, nd->seq))
|
if (read_seqcount_retry(&old->d_seq, nd->seq))
|
||||||
@ -1923,12 +1921,10 @@ static struct dentry *follow_dotdot_rcu(struct nameidata *nd,
|
|||||||
if (unlikely(nd->flags & LOOKUP_BENEATH))
|
if (unlikely(nd->flags & LOOKUP_BENEATH))
|
||||||
return ERR_PTR(-ECHILD);
|
return ERR_PTR(-ECHILD);
|
||||||
nd->next_seq = nd->seq;
|
nd->next_seq = nd->seq;
|
||||||
*inodep = nd->path.dentry->d_inode;
|
|
||||||
return nd->path.dentry;
|
return nd->path.dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dentry *follow_dotdot(struct nameidata *nd,
|
static struct dentry *follow_dotdot(struct nameidata *nd)
|
||||||
struct inode **inodep)
|
|
||||||
{
|
{
|
||||||
struct dentry *parent;
|
struct dentry *parent;
|
||||||
|
|
||||||
@ -1952,13 +1948,11 @@ static struct dentry *follow_dotdot(struct nameidata *nd,
|
|||||||
dput(parent);
|
dput(parent);
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
*inodep = parent->d_inode;
|
|
||||||
return parent;
|
return parent;
|
||||||
|
|
||||||
in_root:
|
in_root:
|
||||||
if (unlikely(nd->flags & LOOKUP_BENEATH))
|
if (unlikely(nd->flags & LOOKUP_BENEATH))
|
||||||
return ERR_PTR(-EXDEV);
|
return ERR_PTR(-EXDEV);
|
||||||
*inodep = nd->path.dentry->d_inode;
|
|
||||||
return dget(nd->path.dentry);
|
return dget(nd->path.dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1967,7 +1961,6 @@ static const char *handle_dots(struct nameidata *nd, int type)
|
|||||||
if (type == LAST_DOTDOT) {
|
if (type == LAST_DOTDOT) {
|
||||||
const char *error = NULL;
|
const char *error = NULL;
|
||||||
struct dentry *parent;
|
struct dentry *parent;
|
||||||
struct inode *inode;
|
|
||||||
|
|
||||||
if (!nd->root.mnt) {
|
if (!nd->root.mnt) {
|
||||||
error = ERR_PTR(set_root(nd));
|
error = ERR_PTR(set_root(nd));
|
||||||
@ -1975,9 +1968,9 @@ static const char *handle_dots(struct nameidata *nd, int type)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if (nd->flags & LOOKUP_RCU)
|
if (nd->flags & LOOKUP_RCU)
|
||||||
parent = follow_dotdot_rcu(nd, &inode);
|
parent = follow_dotdot_rcu(nd);
|
||||||
else
|
else
|
||||||
parent = follow_dotdot(nd, &inode);
|
parent = follow_dotdot(nd);
|
||||||
if (IS_ERR(parent))
|
if (IS_ERR(parent))
|
||||||
return ERR_CAST(parent);
|
return ERR_CAST(parent);
|
||||||
error = step_into(nd, WALK_NOFOLLOW, parent);
|
error = step_into(nd, WALK_NOFOLLOW, parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user