panic if v_writecount is non-zero on last use; print out writecount in vprint
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 22 Jun 1991 01:45:05 +0000 (17:45 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 22 Jun 1991 01:45:05 +0000 (17:45 -0800)
SCCS-vsn: sys/kern/vfs_subr.c 7.60

usr/src/sys/kern/vfs_subr.c

index a1fcb39..bc25070 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)vfs_subr.c  7.59 (Berkeley) %G%
+ *     @(#)vfs_subr.c  7.60 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -670,13 +670,19 @@ void vrele(vp)
 {
        struct proc *p = curproc;               /* XXX */
 
 {
        struct proc *p = curproc;               /* XXX */
 
+#ifdef DIAGNOSTIC
        if (vp == NULL)
                panic("vrele: null vp");
        if (vp == NULL)
                panic("vrele: null vp");
+#endif
        vp->v_usecount--;
        vp->v_usecount--;
-       if (vp->v_usecount < 0)
-               vprint("vrele: bad ref count", vp);
        if (vp->v_usecount > 0)
                return;
        if (vp->v_usecount > 0)
                return;
+#ifdef DIAGNOSTIC
+       if (vp->v_usecount != 0 || vp->v_writecount != 0) {
+               vprint("vrele: bad ref count", vp);
+               panic("vrele: ref cnt");
+       }
+#endif
        if (vfreeh == NULLVP) {
                /*
                 * insert into empty list
        if (vfreeh == NULLVP) {
                /*
                 * insert into empty list
@@ -1041,8 +1047,9 @@ vprint(label, vp)
 
        if (label != NULL)
                printf("%s: ", label);
 
        if (label != NULL)
                printf("%s: ", label);
-       printf("type %s, usecount %d, refcount %d,", typename[vp->v_type],
-               vp->v_usecount, vp->v_holdcnt);
+       printf("type %s, usecount %d, writecount %d, refcount %d,",
+               typename[vp->v_type], vp->v_usecount, vp->v_writecount,
+               vp->v_holdcnt);
        buf[0] = '\0';
        if (vp->v_flag & VROOT)
                strcat(buf, "|VROOT");
        buf[0] = '\0';
        if (vp->v_flag & VROOT)
                strcat(buf, "|VROOT");