Date: Fri, 30 Aug 2019 13:29:43 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Mateusz Guzik <mjg@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351622 - head/sys/kern Message-ID: <20190830102943.GE71821@kib.kiev.ua> In-Reply-To: <201908300045.x7U0jsq9083259@repo.freebsd.org> References: <201908300045.x7U0jsq9083259@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190830102943.GE71821>