All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: fix bdrv_ioctl called from coroutine
Date: Thu, 17 Dec 2015 08:59:46 +0800	[thread overview]
Message-ID: <20151217005946.GA20007@ad.usersys.redhat.com> (raw)
In-Reply-To: <1450290827-30508-5-git-send-email-pbonzini@redhat.com>

On Wed, 12/16 19:33, Paolo Bonzini wrote:
> When called from a coroutine, bdrv_ioctl must be asynchronous just like
> e.g. bdrv_flush.  The code was incorrectly making it synchronous, fix
> it.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>         Fam, any reason why you did it this way?  I don't see
>         any coroutine caller, but it doesn't make much sense. :)

That is a surprising question!  From a coroutine, it is bdrv_flush ->
bdrv_flush_co_entry -> bdrv_co_flush, which I think is always synchronous,
especially, noticing the code around calling bs->bdrv_aio_flush:

        acb = bs->drv->bdrv_aio_flush(bs, bdrv_co_io_em_complete, &co);
        if (acb == NULL) {
            ret = -EIO;
        } else {
            qemu_coroutine_yield();
            ret = co.ret;
        }

Am I missing something?

Fam

> 
>  block/io.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/block/io.c b/block/io.c
> index e00fb5d..841f5b5 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -2614,10 +2614,11 @@ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
>          bdrv_co_ioctl_entry(&data);
>      } else {
>          Coroutine *co = qemu_coroutine_create(bdrv_co_ioctl_entry);
> +
>          qemu_coroutine_enter(co, &data);
> -    }
> -    while (data.ret == -EINPROGRESS) {
> -        aio_poll(bdrv_get_aio_context(bs), true);
> +        while (data.ret == -EINPROGRESS) {
> +            aio_poll(bdrv_get_aio_context(bs), true);
> +        }
>      }
>      return data.ret;
>  }
> -- 
> 2.5.0
> 

  reply	other threads:[~2015-12-17  0:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 18:33 [Qemu-devel] [PATCH] block: fix bdrv_ioctl called from coroutine Paolo Bonzini
2015-12-17  0:59 ` Fam Zheng [this message]
2015-12-17  8:44   ` Paolo Bonzini
2015-12-17 12:33     ` Fam Zheng
2015-12-17 12:51       ` Paolo Bonzini
2015-12-18  1:17         ` Fam Zheng
2015-12-18 12:16 ` Kevin Wolf

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=20151217005946.GA20007@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.