svn commit: r351360 - head/sys/fs/nullfs

Mateusz Guzik mjg at FreeBSD.org
Wed Aug 21 23:24:40 UTC 2019


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);


More information about the svn-src-all mailing list