svn commit: r356362 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sun Jan 5 00:59:17 UTC 2020
Author: mjg
Date: Sun Jan 5 00:59:16 2020
New Revision: 356362
URL: https://svnweb.freebsd.org/changeset/base/356362
Log:
vfs: patch up vnode count assertions to report found value
Modified:
head/sys/kern/vfs_subr.c
Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c Sun Jan 5 00:58:20 2020 (r356361)
+++ head/sys/kern/vfs_subr.c Sun Jan 5 00:59:16 2020 (r356362)
@@ -2846,8 +2846,8 @@ vget_finish(struct vnode *vp, int flags, enum vgetstat
*/
if (refcount_acquire_if_not_zero(&vp->v_usecount)) {
#ifdef INVARIANTS
- int old = atomic_fetchadd_int(&vp->v_holdcnt, -1) - 1;
- VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__));
+ int old = atomic_fetchadd_int(&vp->v_holdcnt, -1);
+ VNASSERT(old > 1, vp, ("%s: wrong hold count %d", __func__, old));
#else
refcount_release(&vp->v_holdcnt);
#endif
@@ -2872,8 +2872,8 @@ vget_finish(struct vnode *vp, int flags, enum vgetstat
*/
if (refcount_acquire_if_not_zero(&vp->v_usecount)) {
#ifdef INVARIANTS
- int old = atomic_fetchadd_int(&vp->v_holdcnt, -1) - 1;
- VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__));
+ int old = atomic_fetchadd_int(&vp->v_holdcnt, -1);
+ VNASSERT(old > 1, vp, ("%s: wrong hold count %d", __func__, old));
#else
refcount_release(&vp->v_holdcnt);
#endif
@@ -2953,7 +2953,7 @@ vrefact(struct vnode *vp)
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
#ifdef INVARIANTS
int old = atomic_fetchadd_int(&vp->v_usecount, 1);
- VNASSERT(old > 0, vp, ("%s: wrong use count", __func__));
+ VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old));
#else
refcount_acquire(&vp->v_usecount);
#endif
@@ -3189,7 +3189,7 @@ vholdnz(struct vnode *vp)
CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
#ifdef INVARIANTS
int old = atomic_fetchadd_int(&vp->v_holdcnt, 1);
- VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__));
+ VNASSERT(old > 0, vp, ("%s: wrong hold count %d", __func__, old));
#else
atomic_add_int(&vp->v_holdcnt, 1);
#endif
More information about the svn-src-all
mailing list