summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-05-06 10:59:00 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-11 08:13:10 -0400
commit63afdfc781e10c6b3ec38274e6163422876caa9a (patch)
treef6f27074c78bbc7831df32d4c77aebb02fce6b81
parent237d8b327abb428ff39b49e32ce07fdac468e32f (diff)
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: David Howells <dhowells@redhat.com>
-rw-r--r--fs/namei.c10
-rw-r--r--fs/open.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 366b0f348d1c..bcacb3100317 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1423,7 +1423,7 @@ static int lookup_fast(struct nameidata *nd,
1423 * This sequence count validates that the inode matches 1423 * This sequence count validates that the inode matches
1424 * the dentry name information from lookup. 1424 * the dentry name information from lookup.
1425 */ 1425 */
1426 *inode = dentry->d_inode; 1426 *inode = d_backing_inode(dentry);
1427 negative = d_is_negative(dentry); 1427 negative = d_is_negative(dentry);
1428 if (read_seqcount_retry(&dentry->d_seq, seq)) 1428 if (read_seqcount_retry(&dentry->d_seq, seq))
1429 return -ECHILD; 1429 return -ECHILD;
@@ -1483,7 +1483,7 @@ unlazy:
1483 path->dentry = dentry; 1483 path->dentry = dentry;
1484 err = follow_managed(path, nd); 1484 err = follow_managed(path, nd);
1485 if (likely(!err)) 1485 if (likely(!err))
1486 *inode = path->dentry->d_inode; 1486 *inode = d_backing_inode(path->dentry);
1487 return err; 1487 return err;
1488 1488
1489need_lookup: 1489need_lookup:
@@ -1618,7 +1618,7 @@ static int walk_component(struct nameidata *nd, int flags)
1618 if (err < 0) 1618 if (err < 0)
1619 return err; 1619 return err;
1620 1620
1621 inode = path.dentry->d_inode; 1621 inode = d_backing_inode(path.dentry);
1622 seq = 0; /* we are already out of RCU mode */ 1622 seq = 0; /* we are already out of RCU mode */
1623 err = -ENOENT; 1623 err = -ENOENT;
1624 if (d_is_negative(path.dentry)) 1624 if (d_is_negative(path.dentry))
@@ -2471,7 +2471,7 @@ EXPORT_SYMBOL(__check_sticky);
2471 */ 2471 */
2472static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) 2472static int may_delete(struct inode *dir, struct dentry *victim, bool isdir)
2473{ 2473{
2474 struct inode *inode = victim->d_inode; 2474 struct inode *inode = d_backing_inode(victim);
2475 int error; 2475 int error;
2476 2476
2477 if (d_is_negative(victim)) 2477 if (d_is_negative(victim))
@@ -3054,7 +3054,7 @@ retry_lookup:
3054 return error; 3054 return error;
3055 3055
3056 BUG_ON(nd->flags & LOOKUP_RCU); 3056 BUG_ON(nd->flags & LOOKUP_RCU);
3057 inode = path.dentry->d_inode; 3057 inode = d_backing_inode(path.dentry);
3058 seq = 0; /* out of RCU mode, so the value doesn't matter */ 3058 seq = 0; /* out of RCU mode, so the value doesn't matter */
3059 if (unlikely(d_is_negative(path.dentry))) { 3059 if (unlikely(d_is_negative(path.dentry))) {
3060 path_to_nameidata(&path, nd); 3060 path_to_nameidata(&path, nd);
diff --git a/fs/open.c b/fs/open.c
index 98e5a52dc68c..e0250bdcc440 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -367,7 +367,7 @@ retry:
367 if (res) 367 if (res)
368 goto out; 368 goto out;
369 369
370 inode = path.dentry->d_inode; 370 inode = d_backing_inode(path.dentry);
371 371
372 if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) { 372 if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {
373 /* 373 /*