qemu-e2k/tests
Alberto Garcia 50a3efb0f0 block: Close a BlockDriverState completely even when bs->drv is NULL
bdrv_close() skips much of its logic when bs->drv is NULL. This is
fine when we're closing a BlockDriverState that has just been created
(because e.g the initialization process failed), but it's not enough
in other cases.

For example, when a valid qcow2 image is found to be corrupted then
QEMU marks it as such in the file header and then sets bs->drv to
NULL in order to make the BlockDriverState unusable. When that BDS is
later closed then many of its data structures are not freed (leaking
their memory) and none of its children are detached. This results in
bdrv_close_all() failing to close all BDSs and making this assertion
fail when QEMU is being shut down:

   bdrv_close_all: Assertion `QTAILQ_EMPTY(&all_bdrv_states)' failed.

This patch makes bdrv_close() do the full uninitialization process
in all cases. This fixes the problem with corrupted images and still
works fine with freshly created BDSs.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 20171106145345.12038-1-berto@igalia.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-11-21 14:54:02 +01:00
..
acpi-test-data tests/acpi-test-data: update _CRS in DSDT 2017-11-16 17:46:53 +02:00
data test-qga: add test for guest-get-osinfo 2017-07-18 05:49:01 -05:00
docker docker: correctly escape $BACKEND in the help output 2017-11-08 10:59:42 +08:00
guest-debug
image-fuzzer
keys tests: Add a test key pair 2017-09-22 10:46:25 +08:00
libqos tests: use g_new() family of functions 2017-10-16 13:29:49 +02:00
migration scripts: Remove debug parameter from QEMUMachine 2017-10-11 15:15:17 -03:00
multiboot tests/multiboot: Fix whitespace failure 2017-08-11 13:23:19 +02:00
qapi-schema qapi: Fix error handling code on alternate conflict 2017-09-01 12:51:04 +02:00
qemu-iotests block: Close a BlockDriverState completely even when bs->drv is NULL 2017-11-21 14:54:02 +01:00
rocker tests: Avoid non-portable 'echo -ARG' 2017-07-11 17:45:00 +02:00
tcg Replace 'struct ucontext' with 'ucontext_t' type 2017-07-20 10:10:28 +01:00
vm basevm: Call logging.basicConfig() 2017-10-11 15:15:17 -03:00
vmstate-static-checker-data
.gitignore tests: Add check-qobject for equality tests 2017-11-17 18:21:30 +01:00
Makefile.include tests: Add check-qobject for equality tests 2017-11-17 18:21:30 +01:00
ac97-test.c
acpi-utils.c tests: Move reusable ACPI code into a utility file 2017-03-02 07:14:27 +02:00
acpi-utils.h tests/bios-tables-test: Fix endianess problems when passing data to iasl 2017-11-16 18:36:54 +02:00
ahci-test.c tests: use g_new() family of functions 2017-10-16 13:29:49 +02:00
atomic_add-bench.c tests: add atomic_add-bench 2016-10-26 08:29:01 -07:00
benchmark-crypto-cipher.c tests: fix incorrect size_t format in benchmark-crypto 2017-09-04 10:45:19 +01:00
benchmark-crypto-hash.c tests: fix incorrect size_t format in benchmark-crypto 2017-09-04 10:45:19 +01:00
benchmark-crypto-hmac.c tests: fix incorrect size_t format in benchmark-crypto 2017-09-04 10:45:19 +01:00
bios-tables-test.c tests/bios-tables-test: Fix endianess problems when passing data to iasl 2017-11-16 18:36:54 +02:00
boot-order-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
boot-sector.c tests/boot-sector: Increase timeout to 600 seconds 2017-09-26 09:11:23 +03:00
boot-sector.h tests/boot-sector: Use mkstemp() to create a unique file name 2016-10-14 10:06:47 +11:00
boot-serial-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
check-block.sh
check-qdict.c tests/qdict: check more get_try_int() cases 2017-06-20 14:31:33 +02:00
check-qjson.c qlit: make qlit_equal_qobject return a bool 2017-09-04 13:09:11 +02:00
check-qlist.c tests: remove /{qnum, qlist, dict}/destroy test 2017-06-20 14:31:31 +02:00
check-qlit.c qlit: Tighten QLit list vs QList comparison 2017-09-04 13:09:12 +02:00
check-qnull.c qapi/qnull: Add own header 2017-11-17 18:21:30 +01:00
check-qnum.c qnum: add uint type 2017-06-20 14:31:31 +02:00
check-qobject.c tests: Add check-qobject for equality tests 2017-11-17 18:21:30 +01:00
check-qom-interface.c
check-qom-proplist.c qapi: drop the sentinel in enum array 2017-09-04 13:09:13 +02:00
check-qstring.c tests: remove /{qnum, qlist, dict}/destroy test 2017-06-20 14:31:31 +02:00
crypto-tls-x509-helpers.c crypto: fix test cert generation to not use SHA1 algorithm 2017-09-04 10:45:19 +01:00
crypto-tls-x509-helpers.h clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
device-introspect-test.c qmp: Include parent type on 'qom-list-types' output 2017-07-17 15:41:30 -03:00
display-vga-test.c qtest: add display-vga-test to ppc64 2017-01-31 10:10:13 +11:00
drive_del-test.c tests: Enable the drive_del test also on s390x 2017-09-19 18:21:32 +02:00
ds1338-test.c
e1000-test.c tests: fix e1000-test leak 2017-03-01 11:51:28 +04:00
e1000e-test.c tests: fix e1000e leaks 2017-03-01 11:51:28 +04:00
eepro100-test.c tests: fix eepro100-test leak 2017-03-01 11:51:05 +04:00
endianness-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
es1370-test.c
fdc-test.c fdc-test: Avoid deprecated 'change' command 2017-05-09 09:14:40 +02:00
fw_cfg-test.c tests: use g_new() family of functions 2017-10-16 13:29:49 +02:00
hd-geo-test.c tests: fix hd-geo-test leaks 2017-03-01 11:51:04 +04:00
i440fx-test.c tests: fix i440fx-test leaks 2017-03-01 11:51:28 +04:00
i82801b11-test.c
ide-test.c IDE: test flush on empty CDROM 2017-08-10 14:33:43 +01:00
intel-hda-test.c
io-channel-helpers.c io: add new qio_channel_{readv, writev, read, write}_all functions 2017-09-05 13:21:58 +01:00
io-channel-helpers.h
ioh3420-test.c
iothread.c aio: introduce aio_co_schedule and aio_co_wake 2017-02-21 11:14:07 +00:00
iothread.h aio: introduce aio_co_schedule and aio_co_wake 2017-02-21 11:14:07 +00:00
ipmi-bt-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
ipmi-kcs-test.c tests: fix ipmi-kcs-test leak 2017-03-01 11:51:05 +04:00
ipoctal232-test.c
ivshmem-test.c qtest: add ivshmem-test for ppc64 2017-01-31 10:10:13 +11:00
libqtest.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
libqtest.h libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
m25p80-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
m48t59-test.c
megasas-test.c megasas: always store SCSIRequest* into MegasasCmd 2017-06-15 11:04:05 +02:00
migration-test.c tests: check that migration parameters are really assigned 2017-10-29 14:06:16 +01:00
ne2000-test.c
numa-test.c numa-test: Use hmp() 2017-09-15 09:05:19 +02:00
nvme-test.c tests: Use null-co:// instead of /dev/null as the dummy image 2017-05-11 11:08:40 +02:00
pc-cpu-test.c tests: use g_new() family of functions 2017-10-16 13:29:49 +02:00
pcnet-test.c
pkix_asn1_tab.c qtest: fix make check complaint in crypto module 2016-10-19 10:09:24 +01:00
pnv-xscom-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
prom-env-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
ptimer-test-stubs.c ptimer-test: do not link to libqemustub.a/libqemuutil.a 2017-09-19 16:19:39 +02:00
ptimer-test.c tests: fix ptimer leaks 2017-03-01 00:09:28 +04:00
ptimer-test.h tests: ptimer: Change the copyright comment 2016-10-24 16:26:53 +01:00
pvpanic-test.c tests: fix qmp response leak 2017-03-01 00:09:28 +04:00
pxe-test.c tests/pxe: Test more NICs when running in SPEED=slow mode 2017-10-15 05:54:44 +03:00
q35-test.c tests/q35-test: add TSEG size checks 2017-06-16 18:44:55 +03:00
qemu-iotests-quick.sh
qht-bench.c tcg: define CF_PARALLEL and use it for TB hashing along with CF_COUNT_MASK 2017-10-24 13:53:41 -07:00
qmp-test.c qapi: Change data type of the FOO_lookup generated for enum FOO 2017-09-04 13:09:13 +02:00
qom-test.c libqtest: Add a generic function to run a callback function for every machine 2017-04-26 14:42:31 +01:00
rcutorture.c
rtas-test.c tests: don't check if qtest_spapr_boot() returns NULL 2016-10-28 09:36:58 +11:00
rtc-test.c rtc-test: introduce more update tests 2017-08-01 17:27:33 +02:00
rtl8139-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
spapr-phb-test.c spapr: Improved placement of PCI host bridges in guest memory map 2016-10-16 12:04:15 +11:00
tco-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
test-aio-multithread.c tests-aio-multithread: fix /aio/multi/schedule race condition 2017-11-08 09:22:55 +00:00
test-aio.c cpus: define QEMUTimerListNotifyCB for QEMU system emulation 2017-03-14 13:28:29 +01:00
test-arm-mptimer.c tests: Add tests for the ARM MPTimer 2016-10-24 16:26:54 +01:00
test-base64.c
test-bitcnt.c tests: New test-bitcnt 2017-01-10 08:49:59 -08:00
test-bitops.c
test-blockjob-txn.c blockjob: strengthen a bit test-blockjob-txn 2017-05-24 16:38:51 -04:00
test-blockjob.c blockjob: introduce block_job_early_fail 2017-05-24 16:38:51 -04:00
test-bufferiszero.c
test-char.c test-char: add hotswap test 2017-07-14 11:04:34 +02:00
test-clone-visitor.c tests/qapi-schema: Avoid 'str' in alternate test cases 2017-05-31 16:04:05 +02:00
test-coroutine.c
test-crypto-afsplit.c
test-crypto-block.c tests: Run the luks tests in test-crypto-block only if encryption is available 2017-11-08 11:03:46 +00:00
test-crypto-cipher.c crypto: add 3des-ede support when using libgcrypt/nettle 2016-12-21 14:26:26 +00:00
test-crypto-hash.c crypto: fix initialization of crypto in tests 2016-10-19 10:23:55 +01:00
test-crypto-hmac.c crypto: add HMAC algorithms testcases 2016-12-22 09:24:59 +00:00
test-crypto-ivgen.c
test-crypto-pbkdf.c
test-crypto-secret.c
test-crypto-tlscredsx509.c
test-crypto-tlssession.c
test-crypto-xts.c
test-cutils.c util/cutils: Change qemu_strtosz*() from int64_t to uint64_t 2017-02-23 20:35:36 +01:00
test-filter-mirror.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
test-filter-redirector.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
test-hbitmap.c hbitmap: Rename serialization_granularity to serialization_align 2017-10-06 16:28:58 +02:00
test-hmp.c qtest: Avoid passing raw strings through hmp() 2017-09-15 09:05:19 +02:00
test-int128.c int128: Use __int128 if available 2016-10-26 08:29:00 -07:00
test-io-channel-buffer.c
test-io-channel-command.c tests: fix leaks in test-io-channel-command 2017-03-01 00:09:28 +04:00
test-io-channel-file.c
test-io-channel-socket.c sockets: Limit SocketAddressLegacy to external interfaces 2017-05-09 09:14:40 +02:00
test-io-channel-tls.c io: fix check for handshake completion in TLS test 2017-09-05 13:21:58 +01:00
test-io-task.c io: fix possible double free of task error object 2017-01-26 10:26:18 +00:00
test-iov.c tests: Use real size for iov tests 2017-09-05 22:34:40 +02:00
test-keyval.c tests: Remove test cases for alternates of 'number' and 'int' 2017-06-19 14:56:29 +02:00
test-logging.c
test-mul64.c
test-netfilter.c tests: Add network filter tests to the check-qtest-s390x list 2017-08-30 18:23:25 +02:00
test-opts-visitor.c qapi: Fix QemuOpts visitor regression on unvisited input 2017-03-22 19:24:34 +01:00
test-qapi-util.c qapi: Change data type of the FOO_lookup generated for enum FOO 2017-09-04 13:09:13 +02:00
test-qdev-global-props.c test-qdev-global-props: Test global property ordering 2017-07-17 15:41:30 -03:00
test-qdist.c
test-qemu-opts.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
test-qga.c test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code 2017-09-15 09:05:18 +02:00
test-qht-par.c
test-qht.c test-qht: perform lookups under rcu_read_lock 2016-10-06 18:04:13 +02:00
test-qmp-commands.c qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
test-qmp-event.c qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
test-qobject-input-visitor.c qapi: Change data type of the FOO_lookup generated for enum FOO 2017-09-04 13:09:13 +02:00
test-qobject-output-visitor.c qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) 2017-09-04 13:09:13 +02:00
test-rcu-list.c
test-replication.c tests: Disable image lock in test-replication 2017-05-11 11:08:41 +02:00
test-shift128.c host-utils: Implement unsigned quadword left/right shift and unit tests 2017-01-31 10:10:14 +11:00
test-string-input-visitor.c qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) 2017-09-04 13:09:13 +02:00
test-string-output-visitor.c qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) 2017-09-04 13:09:13 +02:00
test-thread-pool.c test-thread-pool: use generic AioContext infrastructure 2017-02-21 11:14:07 +00:00
test-throttle.c block: convert ThrottleGroup to object with QOM 2017-09-05 18:12:21 +02:00
test-timed-average.c
test-uuid.c test-uuid: fix leak 2016-11-11 20:53:23 +08:00
test-visitor-serialization.c test-visitor-serialization: Pass &error_abort to qobject_from_json() 2017-03-07 16:07:47 +01:00
test-vmstate.c migration: Route more error paths 2017-09-27 11:44:18 +01:00
test-write-threshold.c
test-x86-cpuid-compat.c qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
test-x86-cpuid.c
test-xbzrle.c migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00
tmp105-test.c
tpci200-test.c
usb-hcd-ehci-test.c tests: fix usb-test leaks 2017-03-01 11:51:29 +04:00
usb-hcd-ohci-test.c
usb-hcd-uhci-test.c tests: Introduce generic device hot-plug/hot-unplug functions 2017-09-15 09:05:18 +02:00
usb-hcd-xhci-test.c tests: Introduce generic device hot-plug/hot-unplug functions 2017-09-15 09:05:18 +02:00
vhost-user-bridge.c vhost-user-bridge: Only process received packets on started queues 2017-10-12 16:57:42 +02:00
vhost-user-test.c vhost-user: disable the *broken* subprocess tests 2017-09-05 19:31:13 +01:00
virtio-9p-test.c tests/virtio-9p-test: Don't call le*_to_cpus on fields of packed struct 2017-03-27 21:15:31 +02:00
virtio-balloon-test.c tests: Enable the very simple virtio tests on s390x, too 2017-10-20 13:32:10 +02:00
virtio-blk-test.c libqtest: Add qtest_[v]startf() 2017-10-20 13:32:10 +02:00
virtio-console-test.c tests: Enable the very simple virtio tests on s390x, too 2017-10-20 13:32:10 +02:00
virtio-net-test.c tests: fix virtio-net-test ISR dependence 2017-06-30 11:03:45 +01:00
virtio-rng-test.c tests: enable virtio tests on SPAPR 2016-10-28 09:36:58 +11:00
virtio-scsi-test.c scsi: move block/scsi.h to include/scsi/constants.h 2017-09-19 14:09:31 +02:00
virtio-serial-test.c tests: Enable the very simple virtio tests on s390x, too 2017-10-20 13:32:10 +02:00
vmgenid-test.c tests/bios-tables-test: Fix endianess problems when passing data to iasl 2017-11-16 18:36:54 +02:00
vmxnet3-test.c
wdt_ib700-test.c