From owner-freebsd-current@FreeBSD.ORG Wed Aug 17 14:26:21 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org 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 EAB8116A41F; Wed, 17 Aug 2005 14:26:21 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E3BB43D46; Wed, 17 Aug 2005 14:26:21 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.40.201] (Not Verified[10.50.40.201]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Wed, 17 Aug 2005 10:41:19 -0400 From: John Baldwin To: freebsd-current@freebsd.org Date: Wed, 17 Aug 2005 10:23:40 -0400 User-Agent: KMail/1.8 References: <17182.1124270021@phk.freebsd.dk> <20050817124459.GF1084@flame.pc> In-Reply-To: <20050817124459.GF1084@flame.pc> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508171023.41877.jhb@FreeBSD.org> Cc: Poul-Henning Kamp , Giorgos Keramidas Subject: Re: Giant around fdfree() in exit1() ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 17 Aug 2005 14:26:22 -0000 On Wednesday 17 August 2005 08:44 am, Giorgos Keramidas wrote: > On 2005-08-17 11:13, Poul-Henning Kamp wrote: > > I'm seeing Giant held in a MNTK_MPSAFE devfs->close without this patch, > > any insight/comments ? > > fdfree() releases POSIX locks the descriptor has. Is it ok to call > VOP_ADVLOCK(..., F_UNLCK, ...) and free() without holding Giant? free() is safe to not need Giant. However, the call to VOP_ADVLOCK() has a VFS_ASSERT_GIANT() in front of it. fork1() does not hold Giant when calling fdfree(). The aio code in vfs_aio.c does hold Giant. I think you could probably push Giant down into fdfree() and remove it from the callers (i.e. apply patch below, remove Giant around fdfree() call in the aio code and push down Giant in fdfree()). It seems that Giant needs to be acquired around VOP_ADVLOCK if it is needed for vp->v_mount using VFS_LOCK_GIANT(vp->v_mount) and a matching VFS_UNLOCK_GIANT() after the VOP. I'm not sure if vrele() is safe yet. If not, then you'll need to lock Giant around the FILEDESC_LOCK at the bottom that contains the calls to vrele() as well. That means that I think you'll still have Giant in your close routine though phk. Maybe you could make the Giant conditional using VFS_LOCK_GIANT() and VFS_UNLOCK_GIANT() again. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org