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

Cy Schubert Cy.Schubert at cschubert.com
Mon Aug 26 13:18:29 UTC 2019


On August 24, 2019 10:13:15 PM PDT, Mateusz Guzik <mjg at FreeBSD.org> wrote:
>Author: mjg
>Date: Sun Aug 25 05:13:15 2019
>New Revision: 351472
>URL: https://svnweb.freebsd.org/changeset/base/351472
>
>Log:
>  nullfs: reduce areas protected by vnode interlock
>  
>Some places only take the interlock to hold the vnode, which was a
>requiremnt
>before they started being manipulated with atomics. Use the newly
>introduced
>  vholdnz to bump the count.
>  
>  Reviewed by:	kib
>  Tested by:	pho
>  Sponsored by:	The FreeBSD Foundation
>  Differential Revision:	https://reviews.freebsd.org/D21358
>
>Modified:
>  head/sys/fs/nullfs/null_vnops.c
>
>Modified: head/sys/fs/nullfs/null_vnops.c
>==============================================================================
>--- head/sys/fs/nullfs/null_vnops.c	Sun Aug 25 05:11:43 2019	(r351471)
>+++ head/sys/fs/nullfs/null_vnops.c	Sun Aug 25 05:13:15 2019	(r351472)
>@@ -668,7 +668,7 @@ null_lock(struct vop_lock1_args *ap)
> 		 * We prevent it from being recycled by holding the vnode
> 		 * here.
> 		 */
>-		vholdl(lvp);
>+		vholdnz(lvp);
> 		error = VOP_LOCK(lvp, flags);
> 
> 		/*
>@@ -710,31 +710,16 @@ static int
> null_unlock(struct vop_unlock_args *ap)
> {
> 	struct vnode *vp = ap->a_vp;
>-	int flags = ap->a_flags;
>-	int mtxlkflag = 0;
> 	struct null_node *nn;
> 	struct vnode *lvp;
> 	int error;
> 
>-	if ((flags & LK_INTERLOCK) != 0)
>-		mtxlkflag = 1;
>-	else if (mtx_owned(VI_MTX(vp)) == 0) {
>-		VI_LOCK(vp);
>-		mtxlkflag = 2;
>-	}
> 	nn = VTONULL(vp);
> 	if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) {
>-		VI_LOCK_FLAGS(lvp, MTX_DUPOK);
>-		flags |= LK_INTERLOCK;
>-		vholdl(lvp);
>-		VI_UNLOCK(vp);
>-		error = VOP_UNLOCK(lvp, flags);
>+		vholdnz(lvp);
>+		error = VOP_UNLOCK(lvp, 0);
> 		vdrop(lvp);
>-		if (mtxlkflag == 0)
>-			VI_LOCK(vp);
> 	} else {
>-		if (mtxlkflag == 2)
>-			VI_UNLOCK(vp);
> 		error = vop_stdunlock(ap);
> 	}
> 
>@@ -845,10 +830,8 @@ null_getwritemount(struct vop_getwritemount_args
>*ap)
> 	VI_LOCK(vp);
> 	xp = VTONULL(vp);
> 	if (xp && (lowervp = xp->null_lowervp)) {
>-		VI_LOCK_FLAGS(lowervp, MTX_DUPOK);
>+		vholdnz(lowervp);
> 		VI_UNLOCK(vp);
>-		vholdl(lowervp);
>-		VI_UNLOCK(lowervp);
> 		VOP_GETWRITEMOUNT(lowervp, ap->a_mpp);
> 		vdrop(lowervp);
> 	} else {

Hi mjg@,

This causes trap 12 a few seconds after mountlate during boot. Reverting this commit allowed it to boot.

Sorry for no backtrace. I managed to 
 revert and test just prior to rushing out to catch the bus, with no time to craft a proper email. I'll post the backtrace when I arrive at work.


-- 
Pardon the typos and autocorrect, small keyboard in use.
Cheers,
Cy Schubert <Cy.Schubert at cschubert.com>
FreeBSD UNIX: <cy at FreeBSD.org> Web: http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.


More information about the svn-src-all mailing list