On Fri, Aug 30, 2019 at 12:45:54AM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Fri Aug 30 00:45:53 2019 > New Revision: 351622 > URL: https://svnweb.freebsd.org/changeset/base/351622 > > Log: > vfs: tidy up assertions in vfs_subr > > - assert unlocked vnode interlock in vref > - assert right counts in vputx > - print debug info for panic in vdrop > > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/kern/vfs_subr.c > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Fri Aug 30 00:40:08 2019 (r351621) > +++ head/sys/kern/vfs_subr.c Fri Aug 30 00:45:53 2019 (r351622) > @@ -2778,6 +2778,7 @@ void > vref(struct vnode *vp) > { > > + ASSERT_VI_UNLOCKED(vp, __func__); > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > _vhold(vp, false); > v_incr_usecount(vp); > @@ -2853,6 +2854,9 @@ vputx(struct vnode *vp, int func) > else > KASSERT(func == VPUTX_VRELE, ("vputx: wrong func")); > ASSERT_VI_UNLOCKED(vp, __func__); > + VNASSERT(vp->v_holdcnt > 0 && vp->v_usecount > 0, vp, A more precise assert condition would also include vp->v_holdcont >= vp->v_usecount
> + ("%s: wrong ref counts", __func__)); > + > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > > if (vp->v_type != VCHR && > @@ -3069,8 +3073,10 @@ _vdrop(struct vnode *vp, bool locked) > else > ASSERT_VI_UNLOCKED(vp, __func__); > CTR2(KTR_VFS, "%s: vp %p", __func__, vp); > - if ((int)vp->v_holdcnt <= 0) > - panic("vdrop: holdcnt %d", vp->v_holdcnt); > + if (__predict_false((int)vp->v_holdcnt <= 0)) { > + vn_printf(vp, "vdrop: holdcnt %d", vp->v_holdcnt); > + panic("vdrop: wrong holdcnt"); > + } > if (!locked) { > if (refcount_release_if_not_last(&vp->v_holdcnt)) > return; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"