Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2019 23:24:40 +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: r351360 - head/sys/fs/nullfs
Message-ID:  <201908212324.x7LNOeTj046593@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Wed Aug 21 23:24:40 2019
New Revision: 351360
URL: https://svnweb.freebsd.org/changeset/base/351360

Log:
  nullfs: lock the vnode with LK_SHARED in null_vptocnp
  
  null_nodeget which follows almost always finds the target vnode in the hash,
  avoiding insmntque1 altogether. Should it be needed, it already checks if the
  lock needs to be upgraded.
  
  Reviewed by:	kib
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20244

Modified:
  head/sys/fs/nullfs/null_subr.c
  head/sys/fs/nullfs/null_vnops.c

Modified: head/sys/fs/nullfs/null_subr.c
==============================================================================
--- head/sys/fs/nullfs/null_subr.c	Wed Aug 21 23:13:00 2019	(r351359)
+++ head/sys/fs/nullfs/null_subr.c	Wed Aug 21 23:24:40 2019	(r351360)
@@ -222,9 +222,6 @@ null_nodeget(mp, lowervp, vpp)
 	 * provide ready to use vnode.
 	 */
 	if (VOP_ISLOCKED(lowervp) != LK_EXCLUSIVE) {
-		KASSERT((MOUNTTONULLMOUNT(mp)->nullm_flags & NULLM_CACHE) != 0,
-		    ("lowervp %p is not excl locked and cache is disabled",
-		    lowervp));
 		vn_lock(lowervp, LK_UPGRADE | LK_RETRY);
 		if ((lowervp->v_iflag & VI_DOOMED) != 0) {
 			vput(lowervp);

Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c	Wed Aug 21 23:13:00 2019	(r351359)
+++ head/sys/fs/nullfs/null_vnops.c	Wed Aug 21 23:24:40 2019	(r351360)
@@ -893,11 +893,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
 		return (ENOENT);
 	}
 
-	/*
-	 * Exclusive lock is required by insmntque1 call in
-	 * null_nodeget()
-	 */
-	error = vn_lock(ldvp, LK_EXCLUSIVE);
+	error = vn_lock(ldvp, LK_SHARED);
 	if (error != 0) {
 		vrele(ldvp);
 		vn_lock(vp, locked | LK_RETRY);



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