From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 4 11:27:41 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7886816A405 for ; Sun, 4 Mar 2007 11:27:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 52D9B13C46B for ; Sun, 4 Mar 2007 11:27:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 0437546EE1; Sun, 4 Mar 2007 06:27:41 -0500 (EST) Date: Sun, 4 Mar 2007 11:27:40 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Divacky Roman In-Reply-To: <20070304093940.GA82483@stud.fit.vutbr.cz> Message-ID: <20070304112652.V60688@fledge.watson.org> References: <20070304093940.GA82483@stud.fit.vutbr.cz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: hackers@freebsd.org Subject: Re: inconsistency in using vn_fullpath1() 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: Sun, 04 Mar 2007 11:27:41 -0000 On Sun, 4 Mar 2007, Divacky Roman wrote: > I noticed that kern___getcwd() calls vn_fullpath1() with Giant held like > this: > > mtx_lock(&Giant); > FILEDESC_LOCK(fdp); > error = vn_fullpath1(td, fdp->fd_cdir, fdp->fd_rdir, tmpbuf, > &bp, buflen); > FILEDESC_UNLOCK(fdp); > mtx_unlock(&Giant); > > on the other hand vn_fullpath() calls it without Giant held like this: > > FILEDESC_LOCK(fdp); > error = vn_fullpath1(td, vn, fdp->fd_rdir, buf, retbuf, MAXPATHLEN); > FILEDESC_UNLOCK(fdp); > > I dont see much difference in the callings so I wonder if holding Giant is > necessary when calling vn_fullpath1(). Because we either - do one unecessary > locking operation or unsufficiently lock it. > > thnx for explaining to me and possibly fixing it. I suspect that the Giant acquisition there is a conservative acquisition based on VFS not having been MPSAFE, and can be removed. Robert N M Watson Computer Laboratory University of Cambridge