From owner-freebsd-bugs Wed Oct 14 10:20:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA24442 for freebsd-bugs-outgoing; Wed, 14 Oct 1998 10:20:05 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA24380 for ; Wed, 14 Oct 1998 10:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id KAA12516; Wed, 14 Oct 1998 10:20:00 -0700 (PDT) Date: Wed, 14 Oct 1998 10:20:00 -0700 (PDT) Message-Id: <199810141720.KAA12516@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: Chris Timmons Subject: Re: kern/8309 Reply-To: Chris Timmons Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/8309; it has been noted by GNATS. From: Chris Timmons To: freebsd-gnats-submit@freebsd.org Cc: Subject: Re: kern/8309 Date: Wed, 14 Oct 1998 10:17:08 -0700 (PDT) Added to the record with the permission of the author... ---------- Forwarded message ---------- Date: Wed, 14 Oct 1998 04:17:57 +0200 From: Tor.Egge@fast.no To: skynyrd@opus.cts.cwu.edu Cc: dt@FreeBSD.ORG, bde@FreeBSD.ORG, jhk@FreeBSD.ORG, dg@FreeBSD.ORG Subject: Re: kern/8309 > #9 0xf013742b in panic (fmt=0xf01ffbb9 "rslock: cpu: %d, addr: 0x%08x, > lock: 0x%08x") at ../../kern/kern_shutdown.c:428 > #10 0xf01ffbb9 in bsl1 () simple_lock (i.e. s_lock) is frameless. The caller is vinvalbuf. > #11 0xf01e1e2c in vm_object_terminate (object=0xf024b014) at > ../../vm/vm_object.c:444 vfs_subr.c has changed recently dt 1998/10/12 13:14:09 PDT Modified files: sys/kern vfs_subr.c Log: UnVMIO vnodes of block devices when they are no longer in use. (Some things, like msdosfs, do not work (panic) on devices with VMIO enabled. FFS enable VMIO on mounted devices, and nothing previously disabled it, so, after you mounted FFS floppy, you could not mount msdosfs floppy anymore...) This is mostly a quick before-release fix. Reviewed by: bde Revision Changes Path 1.164 +13 -2 src/sys/kern/vfs_subr.c That change is broken with regard to locking. vm_object_terminate might block. Thus, the vnode interlock should not be held. Instead, a full lock should be held. Moving the calls to vfs_object_destroy to right before the calls to VOP_INACTIVE looks like an easy fix, but that would introduce a potential vnode leak, since resident page count might be nonzero before vfs_object_destroy is called. By adding some code to vfs_object_destroy, this leak might be plugged. There is very little time left before 3.0 is released. I'll leave this task to the Release Engineer, expecting him to delegate this to somebody else on the CC list. Index: vfs_subr.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.165 diff -u -r1.165 vfs_subr.c --- vfs_subr.c 1998/10/13 08:24:41 1.165 +++ vfs_subr.c 1998/10/14 01:15:57 @@ -1306,8 +1316,13 @@ struct vnode* vp; { if (vp->v_type == VBLK && vp->v_object != NULL && - vp->v_object->ref_count == 0) + vp->v_object->ref_count == 0) { vm_object_terminate(vp->v_object); + simple_lock(&vp->v_interlock); + if (VSHOULDFREE(vp)) + vfree(vp); + simple_unlock(&vp->v_interlock); + } } /* @@ -1336,7 +1351,6 @@ if (vp->v_usecount == 1) { - vfs_object_destroy(vp); vp->v_usecount--; if (VSHOULDFREE(vp)) vfree(vp); @@ -1346,6 +1360,7 @@ * vrele, we explicitly lock the vnode before calling VOP_INACTIVE. */ if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, p) == 0) { + vfs_object_destroy(vp); VOP_INACTIVE(vp, p); } @@ -1381,7 +1396,6 @@ if (vp->v_usecount == 1) { - vfs_object_destroy(vp); vp->v_usecount--; if (VSHOULDFREE(vp)) vfree(vp); @@ -1391,6 +1405,7 @@ * vrele, we explicitly lock the vnode before calling VOP_INACTIVE. */ simple_unlock(&vp->v_interlock); + vfs_object_destroy(vp); VOP_INACTIVE(vp, p); } else { - Tor Egge To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message