svn commit: r190655 - head/sys/kern

Chagin Dmitry dchagin at freebsd.org
Thu Apr 2 23:06:01 PDT 2009


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:

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);
 	}
 	*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);


-- 
Have fun!
chd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090403/69c4a042/attachment.pgp


More information about the svn-src-all mailing list