qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block: fix streaming/closing race


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] block: fix streaming/closing race
Date: Fri, 30 Mar 2012 10:31:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

Il 30/03/2012 09:19, Stefan Hajnoczi ha scritto:
>> > +void block_job_cancel_sync(BlockJob *job)
>> > +{
>> > +    BlockDriverState *bs = job->bs;
>> > +
>> > +    assert(bs->job == job);
>> > +    block_job_cancel(job);
>> > +    while (bs->job != NULL && bs->job->busy) {
> It's not clear to me why we have a busy flag.

Because the coroutine does not restart if you do qemu_aio_wait and the
coroutine is waiting in co_sleep.  So the busy flag communicates that
the coroutine is quiescent and, when cancelled, will not issue any new I/O.

However, even this is not enough.  It fixes a race with closing, but not
with deleting bs.  So the bug does not show anymore when you quit QEMU
(because the coroutine is not restarted), but it is still there if you
hot-unplug a device while streaming is in effect.

> Is canceling and waiting for bs->job == NULL not enough?  Perhaps
> you're trying to take a shortcut and not wait until the job is fully
> stopped

No, simply it's impossible to wait for full completion with qemu_aio_wait.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]