Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2006 10:41:29 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Kostik Belousov <kostikbel@gmail.com>, jeff@freebsd.org
Subject:   Re: [patch] GIANT and fchdir
Message-ID:  <200602031041.31576.jhb@freebsd.org>
In-Reply-To: <c781d7f30602030448k339fbe69rb641e2ade9d60255@mail.gmail.com>
References:  <c781d7f30602030448k339fbe69rb641e2ade9d60255@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 03 February 2006 07:48, Kostik Belousov wrote:
> I have a system where root is on MP-safe UFS, and have (MP-unsafe)
> fdescfs mounted at /dev/fd. Doing "find /" causes panic in line 2029
> of the sys/kern/vfs_subr.c, namely, in vrele() assertion
> VFS_ASSERT_GIANT(vp->v_mount);
>
> Trace shows that the guilty process (find) did the fchdir syscall. Reason
> for the panic is call vrele(vpold) in kern/vfs_syscalls.c, line 718 without
> calling VFS_LOCK_GIANT for vpold.
>
> Problem is quite similar to what was fixed several days ago for chroot
> and chdir.
>
> The following small patch fixes the panic:
>
> Index: sys/kern/vfs_syscalls.c
> ===================================================================
> RCS file: /usr/local/arch/ncvs/src/sys/kern/vfs_syscalls.c,v
> retrieving revision 1.402
> diff -u -r1.402 vfs_syscalls.c
> --- sys/kern/vfs_syscalls.c     1 Feb 2006 09:30:44 -0000       1.402
> +++ sys/kern/vfs_syscalls.c     3 Feb 2006 12:47:13 -0000
> @@ -715,6 +715,8 @@
>         vpold = fdp->fd_cdir;
>         fdp->fd_cdir = vp;
>         FILEDESC_UNLOCK_FAST(fdp);
> +       VFS_UNLOCK_GIANT(vfslocked);
> +       vfslocked = VFS_LOCK_GIANT(vpold->v_mount);
>         vrele(vpold);
>         VFS_UNLOCK_GIANT(vfslocked);
>         return (0);
>
>
> It seems that the issue is present in 6-STABLE too.

Yes, chdir() was just fixed a few days ago.  I think Robert Watson has 
basically the same patch (he drops giant slightly earlier though) that he 
will commit soon.

-- 
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?200602031041.31576.jhb>