Author: mjg
Date: Sat Jul 25 10:40:38 2020
New Revision: 363523
URL: https://svnweb.freebsd.org/changeset/base/363523

Log:
  vfs: add support for !LOCKLEAF to lockless lookup
  
  Tested by:      pho (in a patchset)
  Differential Revision:        https://reviews.freebsd.org/D23916

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c   Sat Jul 25 10:39:41 2020        (r363522)
+++ head/sys/kern/vfs_cache.c   Sat Jul 25 10:40:38 2020        (r363523)
@@ -3029,10 +3029,6 @@ cache_can_fplookup(struct cache_fpl *fpl)
                cache_fpl_aborted(fpl);
                return (false);
        }
-       if ((cnp->cn_flags & LOCKLEAF) == 0) {
-               cache_fpl_aborted(fpl);
-               return (false);
-       }
        if (cnp->cn_nameiop != LOOKUP) {
                cache_fpl_aborted(fpl);
                return (false);
@@ -3120,7 +3116,6 @@ cache_fplookup_final(struct cache_fpl *fpl)
        tvp_seqc = fpl->tvp_seqc;
 
        VNPASS(cache_fplookup_vnode_supported(dvp), dvp);
-       MPASS((cnp->cn_flags & LOCKLEAF) != 0);
 
        tvs = vget_prep_smr(tvp);
        if (tvs == VGET_NONE) {
@@ -3135,13 +3130,20 @@ cache_fplookup_final(struct cache_fpl *fpl)
 
        cache_fpl_smr_exit(fpl);
 
-       error = vget_finish(tvp, cnp->cn_lkflags, tvs);
-       if (error != 0) {
-               return (cache_fpl_aborted(fpl));
+       if ((cnp->cn_flags & LOCKLEAF) != 0) {
+               error = vget_finish(tvp, cnp->cn_lkflags, tvs);
+               if (error != 0) {
+                       return (cache_fpl_aborted(fpl));
+               }
+       } else {
+               vget_finish_ref(tvp, tvs);
        }
 
        if (!vn_seqc_consistent(tvp, tvp_seqc)) {
-               vput(tvp);
+               if ((cnp->cn_flags & LOCKLEAF) != 0)
+                       vput(tvp);
+               else
+                       vrele(tvp);
                return (cache_fpl_aborted(fpl));
        }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to