cvs commit: src/sys/kern vfs_lookup.c
Alexander Kabaev
kabaev at gmail.com
Wed Aug 31 01:16:56 GMT 2005
On Tue, 30 Aug 2005 15:47:04 -0700
Alfred Perlstein <alfred at freebsd.org> wrote:
> 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))
> continue;
> here ->>> vput(dp);
> tvfslocked = VFS_LOCK_GIANT(mp);
> VFS_UNLOCK_GIANT(vfslocked);
> 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
> vnode...
dp != ndp->ni_dvp at that point. If we have amd serving /home,
ndp->ni_dvp is '/' directory
dp is /home directory
Having / locked while waiting for VFS_ROOT on amd filesystem serves no
purpose.
> 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?
>
> -Alfred
>
>
>
> * Alexander Kabaev <kan at FreeBSD.org> [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
> > 1.80.2.1 +2 -0 src/sys/kern/vfs_lookup.c
>
> --
> - Alfred Perlstein
--
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20050830/b8613978/attachment.bin
More information about the cvs-src
mailing list