@@ -513,15 +513,6 @@ static int rbd_open(BlockDriverState *bs, const char *filename, int flags)
qemu_free(hbuf);
- s->efd = eventfd(0, 0);
- if (s->efd < 0) {
- error_report("error opening eventfd");
- goto failed;
- }
- fcntl(s->efd, F_SETFL, O_NONBLOCK);
- qemu_aio_set_fd_handler(s->efd, rbd_aio_completion_cb, NULL,
- rbd_aio_flush_cb, NULL, s);
-
return 0;
failed:
@@ -538,6 +529,9 @@ static void rbd_close(BlockDriverState *bs)
{
BDRVRBDState *s = bs->opaque;
+ close(s->efd);
+ qemu_aio_set_fd_handler(s->efd, NULL , NULL, NULL, NULL, NULL);
+
// The following do not exist in qemu:
// qemu_cond_destroy(s->queue_threshold);
// qemu_mutex_destroy(s->queue_mutex);