VFS: Handle lower layer dentry/inode in pathwalk
authorDavid Howells <dhowells@redhat.com>
Wed, 6 May 2015 14:59:00 +0000 (15:59 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 11 May 2015 12:13:10 +0000 (08:13 -0400)
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: David Howells <dhowells@redhat.com>
fs/namei.c
fs/open.c

index 366b0f348d1cd654e1abaa0e90b7285e8867d90c..bcacb3100317d8ce3ed1a21ce5cce8001383ea82 100644 (file)
@@ -1423,7 +1423,7 @@ static int lookup_fast(struct nameidata *nd,
                 * This sequence count validates that the inode matches
                 * the dentry name information from lookup.
                 */
-               *inode = dentry->d_inode;
+               *inode = d_backing_inode(dentry);
                negative = d_is_negative(dentry);
                if (read_seqcount_retry(&dentry->d_seq, seq))
                        return -ECHILD;
@@ -1483,7 +1483,7 @@ unlazy:
        path->dentry = dentry;
        err = follow_managed(path, nd);
        if (likely(!err))
-               *inode = path->dentry->d_inode;
+               *inode = d_backing_inode(path->dentry);
        return err;
 
 need_lookup:
@@ -1618,7 +1618,7 @@ static int walk_component(struct nameidata *nd, int flags)
                if (err < 0)
                        return err;
 
-               inode = path.dentry->d_inode;
+               inode = d_backing_inode(path.dentry);
                seq = 0;        /* we are already out of RCU mode */
                err = -ENOENT;
                if (d_is_negative(path.dentry))
@@ -2471,7 +2471,7 @@ EXPORT_SYMBOL(__check_sticky);
  */
 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;
 
        if (d_is_negative(victim))
@@ -3054,7 +3054,7 @@ retry_lookup:
                return error;
 
        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 */
        if (unlikely(d_is_negative(path.dentry))) {
                path_to_nameidata(&path, nd);
index 98e5a52dc68c9503136b8ff6a89b44dacd5478bf..e0250bdcc44005db6510ac516a53923282db5d12 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -367,7 +367,7 @@ retry:
        if (res)
                goto out;
 
-       inode = path.dentry->d_inode;
+       inode = d_backing_inode(path.dentry);
 
        if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {
                /*