The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=611470a51560db61488b2d864176b8076eb5a65c

commit 611470a51560db61488b2d864176b8076eb5a65c
Author:     Mateusz Guzik <[email protected]>
AuthorDate: 2022-02-09 20:39:28 +0000
Commit:     Mateusz Guzik <[email protected]>
CommitDate: 2022-02-11 12:29:26 +0000

    cache: remove NOCACHE handling from cache_fplookup_noentry
    
    It was copy-pasted from locked lookup. As LOOKUP operation cannot have
    the flag set it was always ending up setting MAKEENTRY.
---
 sys/kern/vfs_cache.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index a34e0dad74a8..e4766194187f 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -4830,7 +4830,6 @@ cache_fplookup_noentry(struct cache_fpl *fpl)
        struct vnode *dvp, *tvp;
        seqc_t dvp_seqc;
        int error;
-       bool docache;
 
        ndp = fpl->ndp;
        cnp = fpl->cnp;
@@ -4839,6 +4838,8 @@ cache_fplookup_noentry(struct cache_fpl *fpl)
 
        MPASS((cnp->cn_flags & MAKEENTRY) == 0);
        MPASS((cnp->cn_flags & ISDOTDOT) == 0);
+       if (cnp->cn_nameiop == LOOKUP)
+               MPASS((cnp->cn_flags & NOCACHE) == 0);
        MPASS(!cache_fpl_isdotdot(cnp));
 
        /*
@@ -4915,10 +4916,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl)
        /*
         * TODO: provide variants which don't require locking either vnode.
         */
-       cnp->cn_flags |= ISLASTCN;
-       docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE;
-       if (docache)
-               cnp->cn_flags |= MAKEENTRY;
+       cnp->cn_flags |= ISLASTCN | MAKEENTRY;
        cnp->cn_lkflags = LK_SHARED;
        if ((cnp->cn_flags & LOCKSHARED) == 0) {
                cnp->cn_lkflags = LK_EXCLUSIVE;

Reply via email to