Commit 63afdfc7 authored by David Howells's avatar David Howells Committed by Al Viro

VFS: Handle lower layer dentry/inode in pathwalk

Make use of d_backing_inode() in pathwalk to gain access to an
inode or dentry that's on a lower layer.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 237d8b32
...@@ -1423,7 +1423,7 @@ static int lookup_fast(struct nameidata *nd, ...@@ -1423,7 +1423,7 @@ static int lookup_fast(struct nameidata *nd,
* This sequence count validates that the inode matches * This sequence count validates that the inode matches
* the dentry name information from lookup. * the dentry name information from lookup.
*/ */
*inode = dentry->d_inode; *inode = d_backing_inode(dentry);
negative = d_is_negative(dentry); negative = d_is_negative(dentry);
if (read_seqcount_retry(&dentry->d_seq, seq)) if (read_seqcount_retry(&dentry->d_seq, seq))
return -ECHILD; return -ECHILD;
...@@ -1483,7 +1483,7 @@ static int lookup_fast(struct nameidata *nd, ...@@ -1483,7 +1483,7 @@ static int lookup_fast(struct nameidata *nd,
path->dentry = dentry; path->dentry = dentry;
err = follow_managed(path, nd); err = follow_managed(path, nd);
if (likely(!err)) if (likely(!err))
*inode = path->dentry->d_inode; *inode = d_backing_inode(path->dentry);
return err; return err;
need_lookup: need_lookup:
...@@ -1618,7 +1618,7 @@ static int walk_component(struct nameidata *nd, int flags) ...@@ -1618,7 +1618,7 @@ static int walk_component(struct nameidata *nd, int flags)
if (err < 0) if (err < 0)
return err; return err;
inode = path.dentry->d_inode; inode = d_backing_inode(path.dentry);
seq = 0; /* we are already out of RCU mode */ seq = 0; /* we are already out of RCU mode */
err = -ENOENT; err = -ENOENT;
if (d_is_negative(path.dentry)) if (d_is_negative(path.dentry))
...@@ -2471,7 +2471,7 @@ EXPORT_SYMBOL(__check_sticky); ...@@ -2471,7 +2471,7 @@ EXPORT_SYMBOL(__check_sticky);
*/ */
static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) static int may_delete(struct inode *dir, struct dentry *victim, bool isdir)
{ {
struct inode *inode = victim->d_inode; struct inode *inode = d_backing_inode(victim);
int error; int error;
if (d_is_negative(victim)) if (d_is_negative(victim))
...@@ -3054,7 +3054,7 @@ static int do_last(struct nameidata *nd, ...@@ -3054,7 +3054,7 @@ static int do_last(struct nameidata *nd,
return error; return error;
BUG_ON(nd->flags & LOOKUP_RCU); BUG_ON(nd->flags & LOOKUP_RCU);
inode = path.dentry->d_inode; inode = d_backing_inode(path.dentry);
seq = 0; /* out of RCU mode, so the value doesn't matter */ seq = 0; /* out of RCU mode, so the value doesn't matter */
if (unlikely(d_is_negative(path.dentry))) { if (unlikely(d_is_negative(path.dentry))) {
path_to_nameidata(&path, nd); path_to_nameidata(&path, nd);
......
...@@ -367,7 +367,7 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode) ...@@ -367,7 +367,7 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
if (res) if (res)
goto out; goto out;
inode = path.dentry->d_inode; inode = d_backing_inode(path.dentry);
if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) { if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment