Giant around fdfree() in exit1() ?
jhb at FreeBSD.org
Wed Aug 17 14:26:22 GMT 2005
On Wednesday 17 August 2005 08:44 am, Giorgos Keramidas wrote:
> On 2005-08-17 11:13, Poul-Henning Kamp <phk at 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
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-current