tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: vwakeup: neg numoutput
On Mon, Jun 30, 2008 at 09:10:09PM +0200, Manuel Bouyer wrote:
> On Mon, Jun 30, 2008 at 10:27:07AM -0700, Bill Stouder-Studenmund wrote:
> > > > Would this be a good candidate for the atomic update operations? That
> > > > way
> > > > you don't need a lock.
> > >
> > > Could be, but then it needs to be updated atomically everywhere.
> >
> > Right.
> >
> > But if you can't take a lock, then you need to do something. :-) And
> > either cscope or eid (probably eid) can help you change the whole tree at
> > once.
>
> I don't know either, but I can do it with grep :)
>
> I don't know how to translate this kind of construct then:
> mutex_enter(&vp->v_interlock);
> while (vp->v_numoutput > 0)
> cv_wait(&vp->v_cv, &vp->v_interlock);
> mutex_exit(&vp->v_interlock);
You would have to hold the lock to move v_numoutput from a non-zero value to
to zero.
> they're used in several places. There are also places where it seems it's
> expected to have vp->v_numoutput stable for several lines of code:
> vfs_subr2.c:
> mutex_enter(&vp->v_interlock);
> while (vp->v_numoutput != 0)
> cv_wait(&vp->v_cv, &vp->v_interlock);
> dirty = !LIST_EMPTY(&vp->v_dirtyblkhd);
> mutex_exit(&vp->v_interlock);
You can't assume that with v_numoutput, it's only used to ensure that
already in flight I/O operations have completed.
> there's also genfs_do_putpages().
> I'm not sure it's doable to change this to atomic ops.
>
> Last, I suspect ccd.c also has locking issues with v_numoutput and locking.
>
> Would using a software interrupt to run the xbdback handler work to take
> v_interlock mutex ?
Yes.
Andrew
Home |
Main Index |
Thread Index |
Old Index