[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] block/io: allow AIOCB without callback
From: |
Peter Lieven |
Subject: |
[Qemu-devel] [PATCH 1/2] block/io: allow AIOCB without callback |
Date: |
Thu, 20 Aug 2015 10:14:07 +0200 |
If the backend storage is unresponsive and we cancel a request due to
a timeout we cannot immediately destroy the AIOCB because the storage
might complete the original request laster if it is responsive again.
For this purpose allow to set the callback to NULL and ignore it in
this case.
Signed-off-by: Peter Lieven <address@hidden>
---
block/io.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/io.c b/block/io.c
index d4bc83b..e628581 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2007,7 +2007,9 @@ static void bdrv_aio_bh_cb(void *opaque)
qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);
}
qemu_vfree(acb->bounce);
- acb->common.cb(acb->common.opaque, acb->ret);
+ if (acb->common.cb) {
+ acb->common.cb(acb->common.opaque, acb->ret);
+ }
qemu_bh_delete(acb->bh);
acb->bh = NULL;
qemu_aio_unref(acb);
@@ -2075,7 +2077,9 @@ static const AIOCBInfo bdrv_em_co_aiocb_info = {
static void bdrv_co_complete(BlockAIOCBCoroutine *acb)
{
if (!acb->need_bh) {
- acb->common.cb(acb->common.opaque, acb->req.error);
+ if (acb->common.cb) {
+ acb->common.cb(acb->common.opaque, acb->req.error);
+ }
qemu_aio_unref(acb);
}
}
--
1.9.1