* [Qemu-devel] bdrv_read race
@ 2014-08-28 11:52 Vladimir Sementsov-Ogievskij
2014-08-29 16:05 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Sementsov-Ogievskij @ 2014-08-28 11:52 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]
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
sector_num,
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;
}
qemu_coroutine_yield();
return co.ret;
}
is it a bug, or may be I don't understand something?
Best regards,
Vladimir
[-- Attachment #2: Type: text/html, Size: 2059 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] bdrv_read race
2014-08-28 11:52 [Qemu-devel] bdrv_read race Vladimir Sementsov-Ogievskij
@ 2014-08-29 16:05 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2014-08-29 16:05 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskij; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
On Thu, Aug 28, 2014 at 03:52:38PM +0400, Vladimir Sementsov-Ogievskij wrote:
> is it a bug, or may be I don't understand something?
You also opened a bug on launchpad for this. I've already responded to
the bug, please see launchpad.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-29 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 11:52 [Qemu-devel] bdrv_read race Vladimir Sementsov-Ogievskij
2014-08-29 16:05 ` Stefan Hajnoczi
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).