aboutsummaryrefslogtreecommitdiff
path: root/async.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-11-09 11:20:51 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-11-09 11:20:51 +0000
commit9d5c1dc117d1ad881bbc76f6990ee1f9e9f8ef7f (patch)
tree90d4dace696dbff6d0414de85353fdc6b6d39bc6 /async.c
parentb3a9e57d92dff7dd5822f322e4eb49af9e1b70b8 (diff)
parent84aa0140dd4f04f5d993f0db14c40da8d3de2706 (diff)
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Mon 09 Nov 2015 10:08:17 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: blockdev: acquire AioContext in hmp_commit() monitor: add missed aio_context_acquire into vm_completion call aio: Introduce aio-epoll.c aio: Introduce aio_context_setup aio: Introduce aio_external_disabled dataplane: support non-contigious s/g dataplane: simplify indirect descriptor read Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'async.c')
-rw-r--r--async.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/async.c b/async.c
index 9589e4bb7d..e106072a44 100644
--- a/async.c
+++ b/async.c
@@ -325,12 +325,18 @@ AioContext *aio_context_new(Error **errp)
{
int ret;
AioContext *ctx;
+ Error *local_err = NULL;
+
ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext));
+ aio_context_setup(ctx, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ goto fail;
+ }
ret = event_notifier_init(&ctx->notifier, false);
if (ret < 0) {
- g_source_destroy(&ctx->source);
error_setg_errno(errp, -ret, "Failed to initialize event notifier");
- return NULL;
+ goto fail;
}
g_source_set_can_recurse(&ctx->source, true);
aio_set_event_notifier(ctx, &ctx->notifier,
@@ -345,6 +351,9 @@ AioContext *aio_context_new(Error **errp)
ctx->notify_dummy_bh = aio_bh_new(ctx, notify_dummy_bh, NULL);
return ctx;
+fail:
+ g_source_destroy(&ctx->source);
+ return NULL;
}
void aio_context_ref(AioContext *ctx)