[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] avoid core reading with bdrv_read (qemu-io)
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] avoid core reading with bdrv_read (qemu-io) |
Date: |
Tue, 19 Jul 2011 09:52:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 |
Am 19.07.2011 09:33, schrieb Frediano Ziglio:
> This patch apply to kevin coroutine-block branch and avoid code. It
> fix "qcow: Use coroutines" patch. Test case:
>
> $ ./qemu-img create -f qcow aaa.img 1G
> Formatting 'aaa.img', fmt=qcow size=1073741824 encryption=off
> $ ./qemu-io aaa.img
> qemu-io> read 1024 1024
> Segmentation fault
>
> Signed-off-by: Frediano Ziglio <address@hidden>
Thanks for the report. I'll update the patch, but in a slightly
different way that matches the old code better:
diff --git a/block/qcow.c b/block/qcow.c
index 6f7973c..6447c2a 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -573,7 +573,6 @@ static int qcow_aio_read_cb(void *opaque)
if (acb->nb_sectors == 0) {
/* request completed */
- qemu_iovec_from_buffer(acb->qiov, acb->orig_buf, acb->qiov->size);
return 0;
}
@@ -647,6 +646,7 @@ static int qcow_co_readv(BlockDriverState *bs,
int64_t sector_num,
qemu_co_mutex_unlock(&s->lock);
if (acb->qiov->niov > 1) {
+ qemu_iovec_from_buffer(acb->qiov, acb->orig_buf, acb->qiov->size);
qemu_vfree(acb->orig_buf);
}
qemu_aio_release(acb);