qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Priebe - Profihost AG <s.priebe@profihost.ag>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: josh.durgin@inktank.com, ceph-devel@vger.kernel.org,
	qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH] rbd block driver fix race between aio completition and aio cancel
Date: Thu, 29 Nov 2012 15:32:48 +0100	[thread overview]
Message-ID: <50B77210.70009@profihost.ag> (raw)
In-Reply-To: <20121129135851.GA13694@stefanha-thinkpad.redhat.com>

Hi,

i hope i've done everything correctly. I've send a new v4 patch.

Am 29.11.2012 14:58, schrieb Stefan Hajnoczi:
> On Thu, Nov 22, 2012 at 11:00:19AM +0100, Stefan Priebe wrote:
>> @@ -406,10 +401,11 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb)
>>               acb->ret = r;
>>           }
>>       }
>> +    acb->status = 0;
>> +
>
> I suggest doing this in the BH.  The qemu_aio_wait() loop in
> qemu_rbd_aio_cancel() needs to wait until the BH has executed.  By
> clearing status in the BH we ensure that no matter in which order
> qemu_aio_wait() invokes BHs and callbacks, we'll always wait until the
> BH has completed before ending the while loop in qemu_rbd_aio_cancel().
>
>> @@ -737,7 +741,8 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
>>   failed:
>>       g_free(rcb);
>>       s->qemu_aio_count--;
>> -    qemu_aio_release(acb);
>> +    if (!acb->cancelled)
>> +        qemu_aio_release(acb);
>>       return NULL;
>>   }
>
> This scenario is impossible.  We haven't returned the acb back to the
> caller yet so they could not have invoked qemu_aio_cancel().

Greets,
Stefan

  reply	other threads:[~2012-11-29 14:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 10:00 [Qemu-devel] [PATCH] rbd block driver fix race between aio completition and aio cancel Stefan Priebe
2012-11-24 19:54 ` Blue Swirl
2012-11-24 20:21   ` Stefan Priebe
2012-11-27 22:42 ` Josh Durgin
2012-11-29 15:24   ` Paolo Bonzini
2012-11-29 13:58 ` Stefan Hajnoczi
2012-11-29 14:32   ` Stefan Priebe - Profihost AG [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-11-19 20:39 [Qemu-devel] (no subject) Stefan Priebe
2012-11-19 20:39 ` [Qemu-devel] [PATCH] rbd block driver fix race between aio completition and aio cancel Stefan Priebe
2012-11-21  8:56   ` Josh Durgin
2012-11-21  9:07   ` Stefan Hajnoczi
2012-11-21  9:19     ` Stefan Priebe - Profihost AG
2012-11-21 15:34       ` Paolo Bonzini
2012-11-22 10:01     ` Stefan Priebe - Profihost AG

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B77210.70009@profihost.ag \
    --to=s.priebe@profihost.ag \
    --cc=ceph-devel@vger.kernel.org \
    --cc=josh.durgin@inktank.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).