mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-25 12:40:08 +00:00
ed6e216171
laio_init() can fail for a couple of reasons, which will lead to a NULL pointer dereference in laio_attach_aio_context(). To solve this, add a aio_setup_linux_aio() function which is called early in raw_open_common. If this fails, propagate the error up. The signature of aio_get_linux_aio() was not modified, because it seems preferable to return the actual errno from the possible failing initialization calls. Additionally, when the AioContext changes, we need to associate a LinuxAioState with the new AioContext. Use the bdrv_attach_aio_context callback and call the new aio_setup_linux_aio(), which will allocate a new AioContext if needed, and return errors on failures. If it fails for any reason, fallback to threaded AIO with an error message, as the device is already in-use by the guest. Add an assert that aio_get_linux_aio() cannot return NULL. Signed-off-by: Nishanth Aravamudan <naravamudan@digitalocean.com> Message-id: 20180622193700.6523-1-naravamudan@digitalocean.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
33 lines
605 B
C
33 lines
605 B
C
/*
|
|
* Linux native AIO support.
|
|
*
|
|
* Copyright (C) 2009 IBM, Corp.
|
|
* Copyright (C) 2009 Red Hat, Inc.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
#include "qemu/osdep.h"
|
|
#include "block/aio.h"
|
|
#include "block/raw-aio.h"
|
|
|
|
void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context)
|
|
{
|
|
abort();
|
|
}
|
|
|
|
void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context)
|
|
{
|
|
abort();
|
|
}
|
|
|
|
LinuxAioState *laio_init(Error **errp)
|
|
{
|
|
abort();
|
|
}
|
|
|
|
void laio_cleanup(LinuxAioState *s)
|
|
{
|
|
abort();
|
|
}
|