summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-01-09 22:25:28 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2017-01-09 22:25:28 -0500
commita89f833737e6c75df0091ccf6c767b94745463c1 (patch)
treef80d6f87bbacc2c2f2ade147d92a8829f4283cf0 /fs/namei.c
parent209a7fb2104f2724f651870306c65f86850ee953 (diff)
namei.c: fold the check for DCACHE_OP_REVALIDATE into d_revalidate()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/fs/namei.c b/fs/namei.c
index dfe6e32aeec6..2ed2701a74b5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -751,7 +751,10 @@ drop_root_mnt:
751 751
752static inline int d_revalidate(struct dentry *dentry, unsigned int flags) 752static inline int d_revalidate(struct dentry *dentry, unsigned int flags)
753{ 753{
754 return dentry->d_op->d_revalidate(dentry, flags); 754 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
755 return dentry->d_op->d_revalidate(dentry, flags);
756 else
757 return 1;
755} 758}
756 759
757/** 760/**
@@ -1454,19 +1457,14 @@ static struct dentry *lookup_dcache(const struct qstr *name,
1454 struct dentry *dir, 1457 struct dentry *dir,
1455 unsigned int flags) 1458 unsigned int flags)
1456{ 1459{
1457 struct dentry *dentry; 1460 struct dentry *dentry = d_lookup(dir, name);
1458 int error;
1459
1460 dentry = d_lookup(dir, name);
1461 if (dentry) { 1461 if (dentry) {
1462 if (dentry->d_flags & DCACHE_OP_REVALIDATE) { 1462 int error = d_revalidate(dentry, flags);
1463 error = d_revalidate(dentry, flags); 1463 if (unlikely(error <= 0)) {
1464 if (unlikely(error <= 0)) { 1464 if (!error)
1465 if (!error) 1465 d_invalidate(dentry);
1466 d_invalidate(dentry); 1466 dput(dentry);
1467 dput(dentry); 1467 return ERR_PTR(error);
1468 return ERR_PTR(error);
1469 }
1470 } 1468 }
1471 } 1469 }
1472 return dentry; 1470 return dentry;
@@ -1556,8 +1554,7 @@ static int lookup_fast(struct nameidata *nd,
1556 return -ECHILD; 1554 return -ECHILD;
1557 1555
1558 *seqp = seq; 1556 *seqp = seq;
1559 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) 1557 status = d_revalidate(dentry, nd->flags);
1560 status = d_revalidate(dentry, nd->flags);
1561 if (likely(status > 0)) { 1558 if (likely(status > 0)) {
1562 /* 1559 /*
1563 * Note: do negative dentry check after revalidation in 1560 * Note: do negative dentry check after revalidation in
@@ -1579,8 +1576,7 @@ static int lookup_fast(struct nameidata *nd,
1579 dentry = __d_lookup(parent, &nd->last); 1576 dentry = __d_lookup(parent, &nd->last);
1580 if (unlikely(!dentry)) 1577 if (unlikely(!dentry))
1581 return 0; 1578 return 0;
1582 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) 1579 status = d_revalidate(dentry, nd->flags);
1583 status = d_revalidate(dentry, nd->flags);
1584 } 1580 }
1585 if (unlikely(status <= 0)) { 1581 if (unlikely(status <= 0)) {
1586 if (!status) 1582 if (!status)
@@ -1619,8 +1615,7 @@ again:
1619 if (IS_ERR(dentry)) 1615 if (IS_ERR(dentry))
1620 goto out; 1616 goto out;
1621 if (unlikely(!d_in_lookup(dentry))) { 1617 if (unlikely(!d_in_lookup(dentry))) {
1622 if ((dentry->d_flags & DCACHE_OP_REVALIDATE) && 1618 if (!(flags & LOOKUP_NO_REVAL)) {
1623 !(flags & LOOKUP_NO_REVAL)) {
1624 int error = d_revalidate(dentry, flags); 1619 int error = d_revalidate(dentry, flags);
1625 if (unlikely(error <= 0)) { 1620 if (unlikely(error <= 0)) {
1626 if (!error) { 1621 if (!error) {
@@ -3057,9 +3052,6 @@ static int lookup_open(struct nameidata *nd, struct path *path,
3057 if (d_in_lookup(dentry)) 3052 if (d_in_lookup(dentry))
3058 break; 3053 break;
3059 3054
3060 if (!(dentry->d_flags & DCACHE_OP_REVALIDATE))
3061 break;
3062
3063 error = d_revalidate(dentry, nd->flags); 3055 error = d_revalidate(dentry, nd->flags);
3064 if (likely(error > 0)) 3056 if (likely(error > 0))
3065 break; 3057 break;