svn commit: r190655 - head/sys/kern

Kostik Belousov kostikbel at gmail.com
Fri Apr 3 02:44:50 PDT 2009


On Fri, Apr 03, 2009 at 10:05:53AM +0400, Chagin Dmitry wrote:
> On Thu, Apr 02, 2009 at 09:16:20PM +0000, Peter Wemm wrote:
> > Author: peter
> > Date: Thu Apr  2 21:16:20 2009
> > New Revision: 190655
> > URL: http://svn.freebsd.org/changeset/base/190655
> > 
> > Log:
> >   vn_vptocnp() unlocks the name cache and forgets to re-lock it before
> >   returning in one error case, and mistakenly unlocks it for the
> >   umount -f case.
> > 
> 
> vn_vptocnp() consumers expects what in case of error returns
> w/o CACHE_RLOCK held. so you need something like:
Yeah, I do not quite understand this commit.

> 
> diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
> index ea19e13..b06a6c6 100644
> --- a/sys/kern/vfs_cache.c
> +++ b/sys/kern/vfs_cache.c
> @@ -971,18 +971,17 @@ vn_vptocnp(struct vnode **vp, char **bp, char *buf, u_int *buflen)
>  	vdrop(*vp);
>  	VFS_UNLOCK_GIANT(vfslocked);
>  	if (error) {
> -		CACHE_RLOCK();
>  		numfullpathfail2++;
>  		return (error);
>  	}
Yes, this is reversal of the part of the r190655.

>  	*bp = buf + *buflen;
>  	*vp = dvp;
> -	CACHE_RLOCK();
>  	if ((*vp)->v_iflag & VI_DOOMED) {
>  		/* forced unmount */
>  		vdrop(*vp);
>  		return (ENOENT);
>  	}
> +	CACHE_RLOCK();
>  	vdrop(*vp);
>  
>  	return (0);
There, r190655 should be reversed too, instead of doing what you do.
VI_DOOMED should be checked while cache is locked.

> 
> 
> -- 
> Have fun!
> chd


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090403/f4e8a167/attachment.pgp


More information about the svn-src-head mailing list