Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/kern



On Tue, Aug 17, 2010 at 04:45:36PM +0300, Antti Kantee wrote:
> On Tue Aug 17 2010 at 15:41:11 +0200, Juergen Hannken-Illjes wrote:
> > > >         vp->v_freelisthd = NULL;
> > > >         mutex_exit(&vnode_free_list_lock);
> > > >  
> > > > -       if (vp->v_usecount != 0) {
> > > > -               /*
> > > > -                * was referenced again before we got the interlock
> > > > -                * Don't return to freelist - the holder of the last
> > > > -                * reference will destroy it.
> > > > -                */
> > > > -               mutex_exit(&vp->v_interlock);
> > > > -               mutex_enter(&vnode_free_list_lock);
> > > > -               goto retry;
> > > > -       }
> > > > +       KASSERT(vp->v_usecount == 0);
> > > 
> > > It's not obvious from your commit message what prevents it from gaining
> > > a reference after the lock is dropped.
> > 
> > The interlock is taken before the freelist lock is dropped and vnodes on
> > the free lists should never appear on other lists.
> 
> Not even the name cache?
> 
> (I can't remember off the top of my head, but IIRC there's something
> sneaky about it)

Name cache does vtryget() then vget(). As the usecount is zero, vtryget()
fails and vget() gets called with the interlock held and needs the freelist
lock to proceed.

I still don't see a race here.

-- 
Juergen Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)


Home | Main Index | Thread Index | Old Index