Date: Wed, 17 Aug 2005 10:23:40 -0400 From: John Baldwin <jhb@FreeBSD.org> To: freebsd-current@freebsd.org Cc: Poul-Henning Kamp <phk@haven.freebsd.dk>, Giorgos Keramidas <keramida@freebsd.org> Subject: Re: Giant around fdfree() in exit1() ? Message-ID: <200508171023.41877.jhb@FreeBSD.org> In-Reply-To: <20050817124459.GF1084@flame.pc> References: <17182.1124270021@phk.freebsd.dk> <20050817124459.GF1084@flame.pc>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 17 August 2005 08:44 am, Giorgos Keramidas wrote: > On 2005-08-17 11:13, Poul-Henning Kamp <phk@haven.freebsd.dk> 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 <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508171023.41877.jhb>