From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 3 15:41:48 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C858816A420; Fri, 3 Feb 2006 15:41:48 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id D14AE43D69; Fri, 3 Feb 2006 15:41:44 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 7647216 for multiple; Fri, 03 Feb 2006 10:42:22 -0500 Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k13Fffw2010374; Fri, 3 Feb 2006 10:41:42 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 3 Feb 2006 10:41:29 -0500 User-Agent: KMail/1.9.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200602031041.31576.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1273/Fri Feb 3 04:07:04 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: Kostik Belousov , jeff@freebsd.org Subject: Re: [patch] GIANT and fchdir X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2006 15:41:48 -0000 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 <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org