Closing this ticket now, since it's not about upstream QEMU code.

** Changed in: qemu
       Status: New => Invalid

You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

  bdrv_read co-routine re-entered recursively

Status in QEMU:

Bug description:
  calling bdrv_read in a loop leads to the follwing situation:

  bs->drv->bdrv_aio_readv is called, and finally calls bdrv_co_io_em_complete 
in other thread context.
  there is a possibility of calling bdrv_co_io_em_complete before calling 
qemu_coroutine_yield in bdrv_co_io_em. And qemu fails with "co-routine 
re-entered recursively".

  static void bdrv_co_io_em_complete(void *opaque, int ret)
      CoroutineIOCompletion *co = opaque;

      co->ret = ret;
      qemu_coroutine_enter(co->coroutine, NULL);

  static int coroutine_fn bdrv_co_io_em(BlockDriverState *bs, int64_t 
                                        int nb_sectors, QEMUIOVector *iov,
                                        bool is_write)
      CoroutineIOCompletion co = {
          .coroutine = qemu_coroutine_self(),
      BlockDriverAIOCB *acb;

      if (is_write) {
          acb = bs->drv->bdrv_aio_writev(bs, sector_num, iov, nb_sectors,
                                         bdrv_co_io_em_complete, &co);
      } else {
          acb = bs->drv->bdrv_aio_readv(bs, sector_num, iov, nb_sectors,
                                        bdrv_co_io_em_complete, &co);

      trace_bdrv_co_io_em(bs, sector_num, nb_sectors, is_write, acb);
      if (!acb) {
          return -EIO;

      return co.ret;

  is it a bug, or may be I don't understand something?

To manage notifications about this bug go to:

Reply via email to