qemu-e2k/block
Nishanth Aravamudan ed6e216171 linux-aio: properly bubble up errors from initialization
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>
2018-06-27 13:06:34 +01:00
..
accounting.c
backup.c hbitmap: Add @advance param to hbitmap_iter_next() 2018-06-18 17:04:55 +02:00
blkdebug.c block: Support BDRV_REQ_WRITE_UNCHANGED in filters 2018-05-15 16:15:21 +02:00
blkreplay.c block: Support BDRV_REQ_WRITE_UNCHANGED in filters 2018-05-15 16:15:21 +02:00
blkverify.c block: Support BDRV_REQ_WRITE_UNCHANGED in filters 2018-05-15 16:15:21 +02:00
block-backend.c block: fix QEMU crash with scsi-hd and drive_del 2018-06-18 15:03:25 +02:00
bochs.c
cloop.c
commit.c job: Add error message for failing jobs 2018-05-30 13:31:01 +02:00
copy-on-read.c block: Support BDRV_REQ_WRITE_UNCHANGED in filters 2018-05-15 16:15:21 +02:00
create.c block/create: Mark blockdev-create stable 2018-05-30 13:31:18 +02:00
crypto.c block: Make remaining uses of qobject input visitor more robust 2018-06-15 14:49:44 +02:00
crypto.h
curl.c
dirty-bitmap.c block/dirty-bitmap: Add bdrv_dirty_iter_next_area 2018-06-18 17:04:57 +02:00
dmg-bz2.c
dmg.c
dmg.h
file-posix.c linux-aio: properly bubble up errors from initialization 2018-06-27 13:06:34 +01:00
file-win32.c file-win32: Switch to byte-based callbacks 2018-05-15 16:11:41 +02:00
gluster.c block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
io.c block: Allow graph changes in bdrv_drain_all_begin/end sections 2018-06-18 15:03:25 +02:00
iscsi-opts.c
iscsi.c block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
linux-aio.c linux-aio: properly bubble up errors from initialization 2018-06-27 13:06:34 +01:00
Makefile.objs block: Add COR filter driver 2018-05-15 16:15:21 +02:00
mirror.c block/mirror: Add copy mode QAPI interface 2018-06-18 17:05:16 +02:00
nbd-client.c
nbd-client.h
nbd.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
nfs.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
null.c null: Switch to byte-based read/write 2018-05-15 16:11:41 +02:00
nvme.c
parallels.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
parallels.h
qapi.c
qcow2-bitmap.c block/qcow2-bitmap: fix free_bitmap_clusters 2018-06-11 16:18:45 +02:00
qcow2-cache.c
qcow2-cluster.c block: use local path for local headers 2018-05-31 04:16:06 +03:00
qcow2-refcount.c qcow2: Repair OFLAG_COPIED when fixing leaks 2018-06-11 16:18:45 +02:00
qcow2-snapshot.c block: use local path for local headers 2018-05-31 04:16:06 +03:00
qcow2.c qapi: remove empty flat union branches and types 2018-06-22 16:33:46 +02:00
qcow2.h qcow2: Give the refcount cache the minimum possible size by default 2018-05-15 16:15:21 +02:00
qcow.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
qed-check.c
qed-cluster.c
qed-l2-cache.c
qed-table.c
qed.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
qed.h
quorum.c block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
raw-format.c raw: Implement copy offloading 2018-06-01 14:41:47 +01:00
rbd.c rbd: New parameter key-secret 2018-06-15 14:49:44 +02:00
replication.c job: Move completion and cancellation to Job 2018-05-23 14:30:51 +02:00
sheepdog.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
snapshot.c block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
ssh.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
stream.c job: Add error message for failing jobs 2018-05-30 13:31:01 +02:00
throttle-groups.c
throttle.c throttle: Fix crash on reopen 2018-06-11 16:18:45 +02:00
trace-events job: Move completion and cancellation to Job 2018-05-23 14:30:51 +02:00
vdi.c block: Make remaining uses of qobject input visitor more robust 2018-06-15 14:49:44 +02:00
vhdx-endian.c block: use local path for local headers 2018-05-31 04:16:06 +03:00
vhdx-log.c block: use local path for local headers 2018-05-31 04:16:06 +03:00
vhdx.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
vhdx.h
vmdk.c
vpc.c block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
vvfat.c block: ignore_bds_parents parameter for drain functions 2018-06-18 15:03:25 +02:00
vxhs.c block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
win32-aio.c file-win32: Switch to byte-based callbacks 2018-05-15 16:11:41 +02:00
write-threshold.c