From owner-freebsd-arch@FreeBSD.ORG Thu Mar 10 09:05:36 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 505AD16A4CE for ; Thu, 10 Mar 2005 09:05:36 +0000 (GMT) Received: from mail.chesapeake.net (chesapeake.net [208.142.252.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id D95C643D2D for ; Thu, 10 Mar 2005 09:05:35 +0000 (GMT) (envelope-from jroberson@chesapeake.net) Received: from mail.chesapeake.net (localhost [127.0.0.1]) by mail.chesapeake.net (8.12.10/8.12.10) with ESMTP id j2A95Wd4012395; Thu, 10 Mar 2005 04:05:32 -0500 (EST) (envelope-from jroberson@chesapeake.net) Received: from localhost (jroberson@localhost)j2A95W9o012392; Thu, 10 Mar 2005 04:05:32 -0500 (EST) (envelope-from jroberson@chesapeake.net) X-Authentication-Warning: mail.chesapeake.net: jroberson owned process doing -bs Date: Thu, 10 Mar 2005 04:05:32 -0500 (EST) From: Jeff Roberson To: arch@freebsd.org, pete@isilon.com In-Reply-To: <20050310034922.Y20708@mail.chesapeake.net> Message-ID: <20050310040417.A20708@mail.chesapeake.net> References: <20050310034922.Y20708@mail.chesapeake.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: Cleaning up vgone. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2005 09:05:36 -0000 On Thu, 10 Mar 2005, Jeff Roberson wrote: > I've run into a few vclean races and some related problems with VOP_CLOSE > not using locks. I've made some fairly major changes to the way vfs > handles vnode teardown in the process of fixing this. I'll summarize what > I've done here. > > The main problem with teardown was the two stage locking scheme involving > the XLOCK. I got rid of the XLOCK and simply require the vnode lock > throughout the whole operation. To accommodate this, VOP_INACTIVE, > VOP_RECLAIM, VOP_CLOSE, and VOP_REVOKE all require the vnode lock. As > does vgone(). > > Prior to this, vgone() would set XLOCK and then do a LK_DRAIN to make > sure there were no callers waiting in VOP_LOCK so that they would always > see the VI_XLOCK and know that the vnode had changed identities. Now, > vgone sets XLOCK, and all lockers who use vget() and vn_lock() check for This should be "vgone sets VI_DOOMED" which now means "the vnode has been dissociated from it's filesystem". > VI_DOOMED before and after acquiring the vnode lock. To wait for the > transition to complete, you simply wait on the vnode lock. > > This really only required minor changes of the filesystems in the tree. > Most only required the removal of a VOP_UNLOCK in VOP_INACTIVE, and a few > acquired the lock in VOP_CLOSE to do operations which they otherwise could > not. There is one change to ffs and coda which inspect v_data in their > vop_lock routines. This is only safe with the interlock held, where > before the XLOCK would have protected v_data in the one case that could > lead to panic. > > The patch is available at http://www.chesapeake.net/~jroberson/vgone.diff > > Cheers, > Jeff > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" >