From: Paolo Bonzini <pbonzini@redhat.com>
To: Josh Durgin <josh.durgin@inktank.com>
Cc: qemu-devel@nongnu.org, stefanha@gmail.com,
ceph-devel@vger.kernel.org, Stefan Priebe <s.priebe@profihost.ag>
Subject: Re: [PATCH] rbd block driver fix race between aio completition and aio cancel
Date: Thu, 29 Nov 2012 10:24:11 -0500 (EST) [thread overview]
Message-ID: <936506501.16251874.1354202651225.JavaMail.root@redhat.com> (raw)
In-Reply-To: <50B541D6.90707@inktank.com>
> > @@ -574,6 +570,12 @@ static void
> > qemu_rbd_aio_cancel(BlockDriverAIOCB *blockacb)
> > {
> > RBDAIOCB *acb = (RBDAIOCB *) blockacb;
> > acb->cancelled = 1;
> > +
> > + while (acb->status == -EINPROGRESS) {
> > + qemu_aio_wait();
> > + }
> > +
>
> There should be a qemu_vfree(acb->bounce); here
No, because the BH will have run at this point and you'd doubly-free
the buffer.
Paolo
> > + qemu_aio_release(acb);
> > }
> >
> > static AIOPool rbd_aio_pool = {
> > @@ -646,7 +648,8 @@ static void rbd_aio_bh_cb(void *opaque)
> > qemu_bh_delete(acb->bh);
> > acb->bh = NULL;
> >
> > - qemu_aio_release(acb);
> > + if (!acb->cancelled)
> > + qemu_aio_release(acb);
> > }
> >
> > static int rbd_aio_discard_wrapper(rbd_image_t image,
> > @@ -691,6 +694,7 @@ static BlockDriverAIOCB
> > *rbd_start_aio(BlockDriverState *bs,
> > acb->s = s;
> > acb->cancelled = 0;
> > acb->bh = NULL;
> > + acb->status = -EINPROGRESS;
> >
> > if (cmd == RBD_AIO_WRITE) {
> > qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);
> > @@ -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_vfree(acb->bounce) should be here as well, although that's a
> separate bug that's probably never hit.
>
> > + qemu_aio_release(acb);
> > return NULL;
> > }
> >
> >
>
>
next prev parent reply other threads:[~2012-11-29 15:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 10:00 [PATCH] rbd block driver fix race between aio completition and aio cancel Stefan Priebe
2012-11-24 19:54 ` [Qemu-devel] " Blue Swirl
2012-11-24 20:21 ` Stefan Priebe
2012-11-27 22:42 ` Josh Durgin
2012-11-29 15:24 ` Paolo Bonzini [this message]
2012-11-29 13:58 ` Stefan Hajnoczi
2012-11-29 14:32 ` Stefan Priebe - Profihost AG
-- strict thread matches above, loose matches on Subject: below --
2012-11-19 20:39 (no subject) Stefan Priebe
2012-11-19 20:43 ` [PATCH] rbd block driver fix race between aio completition and aio cancel Stefan Priebe
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=936506501.16251874.1354202651225.JavaMail.root@redhat.com \
--to=pbonzini@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=josh.durgin@inktank.com \
--cc=qemu-devel@nongnu.org \
--cc=s.priebe@profihost.ag \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.