Skip site navigation (1)Skip section navigation (2)
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
Subject:   kern/15117: vclean calls vrele leading to deadlock (if usecount > 0)
Message-ID:  <199911271414.PAA00823@mulet.e.kth.se>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911271414.PAA00823>