Subject: vnode bug?
To: None <current-users@NetBSD.ORG, port-i386@NetBSD.ORG>
From: Greg Wohletz <>
List: current-users
Date: 02/10/1998 16:07:16
We have a pentium running 1.3 serving around 20 gigabytes of disk to
various systems via NFS.  Occasionally the system would panic with
in this code in the vrele routine:

#ifdef DIAGNOSTIC       
        if (vp->v_usecount != 0 || vp->v_writecount != 0) {
                vprint("vrele: bad ref count", vp);
                panic("vrele: ref cnt");

In each case v_usecount was -1.  Now recently someone mentioned that the
DIAGNOSTIC checks were for debugging purposes only and were not really
nessicary.  I thought, hmm maybe it isn't a big deal if the ref count goes
negative, and compiled a kernel without DIAGNOSTIC.  This resulted in this
panic being triggered in getnewnode:

                if (vp->v_usecount) {
                        vprint("free vnode", vp);
                        panic("free vnode isn't");

Once again v_usecount was -1, but since the DIAGNOSTIC code was not in
place the vnode with a ref count of -1 was placed on the free list, this
was essentially a timb bomb since as soon as this vnode got allocated again
this other panic would be triggered.

Does anyone know anything about this -1 usecount bug?  I have various core
dumps that I can inspect as needed.