From owner-freebsd-current Mon Oct 13 07:06:32 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id HAA25337 for current-outgoing; Mon, 13 Oct 1997 07:06:32 -0700 (PDT) (envelope-from owner-freebsd-current) Received: from eclogite.eps.nagoya-u.ac.jp (eclogite.eps.nagoya-u.ac.jp [133.6.57.67]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id HAA25329 for ; Mon, 13 Oct 1997 07:06:28 -0700 (PDT) (envelope-from kato@eclogite.eps.nagoya-u.ac.jp) Received: from gneiss.eps.nagoya-u.ac.jp (gneiss.eps.nagoya-u.ac.jp [133.6.57.99]) by eclogite.eps.nagoya-u.ac.jp (8.8.7/3.3W9) with ESMTP id XAA17585; Mon, 13 Oct 1997 23:07:39 +0900 (JST) Received: from marble.eps.nagoya-u.ac.jp (localhost [127.0.0.1]) by gneiss.eps.nagoya-u.ac.jp (8.8.7/3.5Wpl5) with ESMTP id XAA01515; Mon, 13 Oct 1997 23:06:05 +0900 (JST) Message-Id: <199710131406.XAA01515@gneiss.eps.nagoya-u.ac.jp> To: joerg_wunsch@uriah.heep.sax.de Cc: freebsd-current@freebsd.org Subject: Re: lockmgr panic From: KATO Takenori In-Reply-To: Your message of "Mon, 13 Oct 1997 08:41:58 +0200" References: <19971013084158.HG40991@uriah.heep.sax.de> X-Mailer: Mew version 1.70 on Emacs 19.28.1 / Mule 2.3 X-PGP-Fingerprint: 03 72 85 36 62 46 23 03 52 B1 10 22 44 10 0D 9E Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 13 Oct 1997 23:06:05 +0900 Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > I thought we got rid of this kind of panics finally? Apparently not: Problem still exists in both 3.0-current and RELENG_2_2, that is, 2.2.5 will be panic by same reason. Stack trace shows: 1. Write a buffer to the ufs on the vn driver. 2. vnstrategy locks the vnode and calls ffs_write. 3. ffs_write call ffs_balloc to obtain a buffer. 4. buffer is not memory resident. 5. The last used buffer is prepared to reuse. 6. The last used buffer is a dirty buffer which is used for the ufs on the vn driver. 7. vnstrategy is called again to flush the dirty buffer. 8. Because vnode has been already locked, the system panics. I don't have any idea to solve this problem except: a. rewrite delayed write stuff. b. rewrite vn driver. c. apply the patch included in this mail. The patch from 3.0-current is as follows: ---------- BEGIN ---------- *** vn.c.ORIG Mon Oct 13 22:06:06 1997 --- vn.c Mon Oct 13 22:12:34 1997 *************** *** 228,233 **** --- 228,234 ---- register struct vn_softc *vn = vn_softc[unit]; register daddr_t bn; int error; + int isvplocked; long sz; struct uio auio; struct iovec aiov; *************** *** 276,287 **** auio.uio_rw = UIO_WRITE; auio.uio_resid = bp->b_bcount; auio.uio_procp = curproc; ! vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); if( bp->b_flags & B_READ) error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred); else error = VOP_WRITE(vn->sc_vp, &auio, 0, vn->sc_cred); ! VOP_UNLOCK(vn->sc_vp, 0, curproc); bp->b_resid = auio.uio_resid; if( error ) --- 277,294 ---- auio.uio_rw = UIO_WRITE; auio.uio_resid = bp->b_bcount; auio.uio_procp = curproc; ! if (!VOP_ISLOCKED(vn->sc_vp)) { ! isvplocked = 1; ! vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); ! } if( bp->b_flags & B_READ) error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred); else error = VOP_WRITE(vn->sc_vp, &auio, 0, vn->sc_cred); ! if (isvplocked) { ! VOP_UNLOCK(vn->sc_vp, 0, curproc); ! isvplocked = 0; ! } bp->b_resid = auio.uio_resid; if( error ) *************** *** 305,314 **** int off, s, nra; nra = 0; vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); error = VOP_BMAP(vn->sc_vp, (daddr_t)(byten / bsize), &vp, &nbn, &nra, NULL); ! VOP_UNLOCK(vn->sc_vp, 0, curproc); if (error == 0 && nbn == -1) error = EIO; --- 312,328 ---- int off, s, nra; nra = 0; + if (!VOP_ISLOCKED(vn->sc_vp)) { + isvplocked = 1; + vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); + } vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); error = VOP_BMAP(vn->sc_vp, (daddr_t)(byten / bsize), &vp, &nbn, &nra, NULL); ! if (isvplocked) { ! VOP_UNLOCK(vn->sc_vp, 0, curproc); ! isvplocked = 0; ! } if (error == 0 && nbn == -1) error = EIO; ---------- END ---------- ---- KATO Takenori Dept. Earth Planet. Sci., Nagoya Univ., Nagoya, 464-01, Japan PGP public key: finger kato@eclogite.eps.nagoya-u.ac.jp ------------------- Powered by FreeBSD(98) -------------------