From owner-freebsd-bugs Sat Nov 27 6:20: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 4799214D09 for ; Sat, 27 Nov 1999 06:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id GAA40089; Sat, 27 Nov 1999 06:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from mulet.e.kth.se (mulet.e.kth.se [130.237.43.20]) by hub.freebsd.org (Postfix) with ESMTP id 8128014CCF for ; Sat, 27 Nov 1999 06:14:22 -0800 (PST) (envelope-from root@mulet.e.kth.se) Received: (from root@localhost) by mulet.e.kth.se (8.9.3/8.9.3) id PAA00823; Sat, 27 Nov 1999 15:14:34 +0100 (CET) (envelope-from root) Message-Id: <199911271414.PAA00823@mulet.e.kth.se> Date: Sat, 27 Nov 1999 15:14:34 +0100 (CET) From: assar@stacken.kth.se To: FreeBSD-gnats-submit@freebsd.org Cc: assar@stacken.kth.se X-Send-Pr-Version: 3.2 Subject: kern/15117: vclean calls vrele leading to deadlock (if usecount > 0) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 15117 >Category: kern >Synopsis: vclean calls vrele leading to deadlock (if usecount > 0) >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 27 06:20:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Assar Westerlund >Release: FreeBSD 4.0-CURRENT i386 >Organization: none >Environment: -current as of ~ today >Description: vclean() calls vrele() if v_usecount of the node was higher than one. But before calling it, it sets the VXLOCK flag, which will make vn_lock called from vrele dead-lock. >How-To-Repeat: >Fix: [ largely based on the NetBSD - code ] --- vfs_subr.c.orig Sat Nov 27 14:54:10 1999 +++ vfs_subr.c Sat Nov 27 15:11:47 1999 @@ -1693,8 +1693,23 @@ if (VOP_RECLAIM(vp, p)) panic("vclean: cannot reclaim"); - if (active) - vrele(vp); + if (active) { + /* + * Inline copy of vrele() since VOP_INACTIVE + * has already been called. + */ + simple_lock(&vp->v_interlock); + if (--vp->v_usecount <= 0) { +#ifdef DIAGNOSTIC + if (vp->v_usecount < 0 || vp->v_writecount != 0) { + vprint("vclean: bad ref count", vp); + panic("vclean: ref cnt"); + } +#endif + vfree(vp); + } + simple_unlock(&vp->v_interlock); + } cache_purge(vp); if (vp->v_vnlock) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message