diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/namei.c b/fs/namei.c index b3c1a975c834..42ccb97cc260 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -436,28 +436,6 @@ static inline int d_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
436 | return dentry->d_op->d_revalidate(dentry, nd); | 436 | return dentry->d_op->d_revalidate(dentry, nd); |
437 | } | 437 | } |
438 | 438 | ||
439 | static struct dentry * | ||
440 | do_revalidate(struct dentry *dentry, struct nameidata *nd) | ||
441 | { | ||
442 | int status = d_revalidate(dentry, nd); | ||
443 | if (unlikely(status <= 0)) { | ||
444 | /* | ||
445 | * The dentry failed validation. | ||
446 | * If d_revalidate returned 0 attempt to invalidate | ||
447 | * the dentry otherwise d_revalidate is asking us | ||
448 | * to return a fail status. | ||
449 | */ | ||
450 | if (status < 0) { | ||
451 | dput(dentry); | ||
452 | dentry = ERR_PTR(status); | ||
453 | } else if (!d_invalidate(dentry)) { | ||
454 | dput(dentry); | ||
455 | dentry = NULL; | ||
456 | } | ||
457 | } | ||
458 | return dentry; | ||
459 | } | ||
460 | |||
461 | /** | 439 | /** |
462 | * complete_walk - successful completion of path walk | 440 | * complete_walk - successful completion of path walk |
463 | * @nd: pointer nameidata | 441 | * @nd: pointer nameidata |
@@ -1642,8 +1620,24 @@ static struct dentry *__lookup_hash(struct qstr *name, | |||
1642 | return dentry; | 1620 | return dentry; |
1643 | } | 1621 | } |
1644 | 1622 | ||
1645 | if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) | 1623 | if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) { |
1646 | dentry = do_revalidate(dentry, nd); | 1624 | int status = d_revalidate(dentry, nd); |
1625 | if (unlikely(status <= 0)) { | ||
1626 | /* | ||
1627 | * The dentry failed validation. | ||
1628 | * If d_revalidate returned 0 attempt to invalidate | ||
1629 | * the dentry otherwise d_revalidate is asking us | ||
1630 | * to return a fail status. | ||
1631 | */ | ||
1632 | if (status < 0) { | ||
1633 | dput(dentry); | ||
1634 | return ERR_PTR(status); | ||
1635 | } else if (!d_invalidate(dentry)) { | ||
1636 | dput(dentry); | ||
1637 | dentry = NULL; | ||
1638 | } | ||
1639 | } | ||
1640 | } | ||
1647 | 1641 | ||
1648 | if (!dentry) | 1642 | if (!dentry) |
1649 | dentry = d_alloc_and_lookup(base, name, nd); | 1643 | dentry = d_alloc_and_lookup(base, name, nd); |