From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDZ1M-0001wl-QE for qemu-devel@nongnu.org; Fri, 30 Mar 2012 06:25:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDZ1L-0003e4-6T for qemu-devel@nongnu.org; Fri, 30 Mar 2012 06:25:28 -0400 Received: from mail-lpp01m010-f45.google.com ([209.85.215.45]:62586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDZ1K-0003dq-Rm for qemu-devel@nongnu.org; Fri, 30 Mar 2012 06:25:27 -0400 Received: by lahe6 with SMTP id e6so578797lah.4 for ; Fri, 30 Mar 2012 03:25:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4F756F51.5010603@redhat.com> References: <1333037320-20564-1-git-send-email-pbonzini@redhat.com> <20120330071921.GB16159@stefanha-thinkpad.localdomain> <4F756F51.5010603@redhat.com> Date: Fri, 30 Mar 2012 11:25:24 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block: fix streaming/closing race List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com On Fri, Mar 30, 2012 at 9:31 AM, Paolo Bonzini wrote: > Il 30/03/2012 09:19, Stefan Hajnoczi ha scritto: >>> > +void block_job_cancel_sync(BlockJob *job) >>> > +{ >>> > + =A0 =A0BlockDriverState *bs =3D job->bs; >>> > + >>> > + =A0 =A0assert(bs->job =3D=3D job); >>> > + =A0 =A0block_job_cancel(job); >>> > + =A0 =A0while (bs->job !=3D 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. =A0So the busy flag communicates that > the coroutine is quiescent and, when cancelled, will not issue any new I/= O. Ah, yes. This is tricky, a comment would be nice. Stefan