Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Mar 2007 11:27:40 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Divacky Roman <xdivac02@stud.fit.vutbr.cz>
Cc:        hackers@freebsd.org
Subject:   Re: inconsistency in using vn_fullpath1()
Message-ID:  <20070304112652.V60688@fledge.watson.org>
In-Reply-To: <20070304093940.GA82483@stud.fit.vutbr.cz>
References:  <20070304093940.GA82483@stud.fit.vutbr.cz>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070304112652.V60688>