From owner-freebsd-current@FreeBSD.ORG Sat Dec 13 09:00:59 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3AD0E16A4CE for ; Sat, 13 Dec 2003 09:00:59 -0800 (PST) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 3759C43D41 for ; Sat, 13 Dec 2003 09:00:50 -0800 (PST) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 13 Dec 2003 17:00:49 +0000 (GMT) To: Bruce Cran In-Reply-To: Your message of "Wed, 10 Dec 2003 23:45:38 GMT." <20031210234538.GA746@buffy.brucec.backnet> Date: Sat, 13 Dec 2003 17:00:47 +0000 From: Ian Dowse Message-ID: <200312131700.aa73241@salmon.maths.tcd.ie> cc: Jeff Roberson cc: freebsd-current@freebsd.org Subject: Re: panic: getnewvnode: free vnode isn't X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2003 17:00:59 -0000 In message <20031210234538.GA746@buffy.brucec.backnet>, Bruce Cran writes: >#10 0xc04bb923 in panic (fmt=0xc05f16d7 "getnewvnode: free vnode isn't") > at /usr/src/sys/kern/kern_shutdown.c:534 >#11 0xc0500fb5 in getnewvnode (tag=0xc05f432f "ufs", mp=0xc43f2000, vops=0x0, > vpp=0x0) at /usr/src/sys/kern/vfs_subr.c:1004 Could people seeing this panic try the following patch? I haven't thought through this in much detail, but it seems that vnodes should be removed from the free list before being cleaned. The addition of the VI_DOINGINACT test about a year ago probably made this panic more likely, but I don't know why it has suddenly cropped up recently. Jeff, does this look reasonable to you? It seems that while most callers of vclean() ensure that the vnode is not on the free list, some direct users of vgone/vgonel do not (e.g. vflush, vrecycle). This could result in a vnode being on the free list while it is being recycled. BTW, I think we may no longer need to increment the reference count in vclean(), and the comment about VOP_INACTIVE before the VOP_LOCK() call is no longer accurate. I guess it's possible that this could also affect the sysinstall crash, but that is probably unlikely. Ian Index: vfs_subr.c =================================================================== RCS file: /home/iedowse/CVS/src/sys/kern/vfs_subr.c,v retrieving revision 1.473 diff -u -r1.473 vfs_subr.c --- vfs_subr.c 30 Nov 2003 22:09:58 -0000 1.473 +++ vfs_subr.c 13 Dec 2003 16:15:44 -0000 @@ -2531,6 +2531,9 @@ int active; ASSERT_VI_LOCKED(vp, "vclean"); + /* The vnode must not be on the free list while being cleaned. */ + if (vp->v_iflag & VI_FREE) + vbusy(vp); /* * Check to see if the vnode is in use. If so we have to reference it * before we clean it out so that its count cannot fall to zero and