qemu/tests
Kevin Wolf ac2ae233a0 block: Introduce bdrv_schedule_unref()
bdrv_unref() is called by a lot of places that need to hold the graph
lock (it naturally happens in the context of operations that change the
graph). However, bdrv_unref() takes the graph writer lock internally, so
it can't actually be called while already holding a graph lock without
causing a deadlock.

bdrv_unref() also can't just become GRAPH_WRLOCK because it drains the
node before closing it, and draining requires that the graph is
unlocked.

The solution is to defer deleting the node until we don't hold the lock
any more and draining is possible again.

Note that keeping images open for longer than necessary can create
problems, too: You can't open an image again before it is really closed
(if image locking didn't prevent it, it would cause corruption).
Reopening an image immediately happens at least during bdrv_open() and
bdrv_co_create().

In order to solve this problem, make sure to run the deferred unref in
bdrv_graph_wrunlock(), i.e. the first possible place where we can drain
again. This is also why bdrv_schedule_unref() is marked GRAPH_WRLOCK.

The output of iotest 051 is updated because the additional polling
changes the order of HMP output, resulting in a new "(qemu)" prompt in
the test output that was previously on a separate line and filtered out.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230911094620.45040-6-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-09-20 17:46:01 +02:00
..
avocado tests/: spelling fixes 2023-09-08 13:08:52 +03:00
bench migration/xbzrle: Use i386 host/cpuinfo.h 2023-05-23 16:51:18 -07:00
data tests/acpi: update virt/SSDT.memhp 2023-09-18 15:27:27 +02:00
decode tests/: spelling fixes 2023-09-08 13:08:52 +03:00
docker net: add initial support for AF_XDP network backend 2023-09-18 14:36:13 +08:00
fp tests: fp: remove unused submodules 2023-06-07 11:05:09 +02:00
guest-debug tests/tcg: clean-up gdb confirm/pagination settings 2023-08-30 14:57:50 +01:00
image-fuzzer
include
keys
lcitool net: add initial support for AF_XDP network backend 2023-09-18 14:36:13 +08:00
migration tests/: spelling fixes 2023-09-08 13:08:52 +03:00
multiboot
perf/block/qcow2
plugin tests/: spelling fixes 2023-09-08 13:08:52 +03:00
qapi-schema tests/: spelling fixes 2023-09-08 13:08:52 +03:00
qemu-iotests block: Introduce bdrv_schedule_unref() 2023-09-20 17:46:01 +02:00
qtest tests/acpi: disallow virt/SSDT.memhp updates 2023-09-18 15:27:27 +02:00
rocker
tcg fpu: Handle m68k extended precision denormals properly 2023-09-16 14:57:16 +00:00
tsan tests/: spelling fixes 2023-09-08 13:08:52 +03:00
uefi-test-tools tests/: spelling fixes 2023-09-08 13:08:52 +03:00
unit block: Take AioContext lock for bdrv_append() more consistently 2023-09-20 17:46:00 +02:00
vm tests/: spelling fixes 2023-09-08 13:08:52 +03:00
vmstate-static-checker-data
dbus-vmstate-daemon.sh
Makefile.include configure, meson: move --enable-plugins to meson 2023-09-07 13:32:37 +02:00
meson.build configure, meson: remove target OS symbols from config-host.mak 2023-09-07 13:32:37 +02:00
test-qht-par.c
vhost-user-bridge.c error handling: Use RETRY_ON_EINTR() macro where applicable 2023-01-09 13:50:47 +01:00