Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jul 2020 10:40:38 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363523 - head/sys/kern
Message-ID:  <202007251040.06PAec7C044334@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007251040.06PAec7C044334>