cvs commit: src/sys/kern vfs_lookup.c

Alfred Perlstein alfred at
Tue Aug 30 22:47:05 GMT 2005

Ok, maybe I'm missing something, but...

	while (dp->v_type == VDIR && (mp = dp->v_mountedhere) &&
	       (cnp->cn_flags & NOCROSSMOUNT) == 0) {
		KASSERT(dp != ndp->ni_dvp, ("XXX"));
		if (vfs_busy(mp, 0, 0, td))
here ->>>	vput(dp);
		tvfslocked = VFS_LOCK_GIANT(mp);
		vfslocked = tvfslocked;
		VOP_UNLOCK(ndp->ni_dvp, 0, td);
		error = VFS_ROOT(mp, cnp->cn_lkflags, &tdp, td);
		VOP_LOCK(ndp->ni_dvp, cnp->cn_lkflags | LK_RETRY, td);
		vfs_unbusy(mp, td);
		if (error) {
			dpunlocked = 1;
			goto bad2;
		ndp->ni_vp = dp = tdp;

Isn't dp already unlocked here?  vput should be unlocking the vnode
and we have the above KASSERT showing that they should be the same

Also, I think lockparent doesn't need to be respected because
we're trading parent vnodes.  Basically, we're hitting a vnode
that has another vnode stacked on it (root vnode), and switching to it.
we're not actually decending.

Is this OK?


* Alexander Kabaev <kan at> [050830 09:12] wrote:
> kan         2005-08-30 16:12:03 UTC
>   FreeBSD src repository
>   Modified files:        (Branch: RELENG_6)
>     sys/kern             vfs_lookup.c 
>   Log:
>   MFC r1.81:
>   Do not keep parent directory locked while calling VFS_ROOT to
>   traverse mount points in lookup(). The lock can be dropped safely
>   around VFS_ROOT because LOCKPARENT semantics with child and parent
>   vnodes coming from different FSes does not really have any meaningful
>   use and we do not really care about parent state after we relock it.
>   This prevents easily triggered deadlock on systems using automounter
>   daemon.
>   Approved by:    re (scottl)
>   Revision  Changes    Path
>  +2 -0      src/sys/kern/vfs_lookup.c

- Alfred Perlstein

More information about the cvs-src mailing list