xemu/block
Alberto Garcia b441dc71c0 block: Make bdrv_root_attach_child() unref child_bs on failure
A consequence of the previous patch is that bdrv_attach_child()
transfers the reference to child_bs from the caller to parent_bs,
which will drop it on bdrv_close() or when someone calls
bdrv_unref_child().

But this only happens when bdrv_attach_child() succeeds. If it fails
then the caller is responsible for dropping the reference to child_bs.

This patch makes bdrv_attach_child() take the reference also when
there is an error, freeing the caller for having to do it.

A similar situation happens with bdrv_root_attach_child(), so the
changes on this patch affect both functions.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 20dfb3d9ccec559cdd1a9690146abad5d204a186.1557754872.git.berto@igalia.com
[mreitz: Removed now superfluous BdrvChild * variable in
         bdrv_open_child()]
Signed-off-by: Max Reitz <mreitz@redhat.com>
2019-05-28 20:30:55 +02:00
..
accounting.c block/accounting: introduce latency histogram 2018-03-19 14:58:37 -05:00
backup.c block/backup: refactor: split out backup_calculate_cluster_size 2019-05-28 20:30:55 +02:00
blkdebug.c block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers 2019-03-26 11:37:51 +01:00
blklogwrites.c block: Purify .bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
blkreplay.c trivial: Make bios files and source files non-executable 2018-09-25 17:26:18 +02:00
blkverify.c block: Purify .bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
block-backend.c block: Make bdrv_root_attach_child() unref child_bs on failure 2019-05-28 20:30:55 +02:00
bochs.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
cloop.c block: Require auto-read-only for existing fallbacks 2018-11-05 15:09:55 +01:00
commit.c commit: Use bdrv_append() in commit_start() 2019-05-07 17:14:21 +02:00
copy-on-read.c block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers 2019-03-26 11:37:51 +01:00
create.c jobs: utilize job_exit shim 2018-08-31 16:28:33 +02:00
crypto.c block: Make bdrv_{copy_on_read,crypto_luks,replication} static 2019-03-19 15:49:29 +01:00
crypto.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
curl.c block/curl: Implement bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
dirty-bitmap.c bitmaps: Fix typo in function name 2019-03-12 12:05:49 -04:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg-lzfse.c block: adding lzfse decompressing support as a module. 2018-12-14 11:52:40 +01:00
dmg.c dmg: don't skip zero chunk 2019-01-04 11:15:09 +00:00
dmg.h dmg: including dmg-lzfse module inside dmg block driver. 2018-12-14 11:52:40 +01:00
file-posix.c block/file-posix: Unaligned O_DIRECT block-status 2019-05-20 17:08:57 +02:00
file-win32.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
gluster.c block/gluster: limit the transfer size to 512 MiB 2019-04-02 12:04:44 +02:00
io.c block: Use BDRV_REQUEST_MAX_BYTES instead of BDRV_REQUEST_MAX_SECTORS 2019-05-20 17:08:56 +02:00
iscsi-opts.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
iscsi.c block/iscsi: Restrict Linux-specific code 2019-03-11 16:33:49 +01:00
linux-aio.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
Makefile.objs qcow2: add separate file for threaded data processing functions 2019-05-28 20:30:55 +02:00
mirror.c blockjob: Propagate AioContext change to all job nodes 2019-05-20 17:08:56 +02:00
nbd-client.c nbd/client: Trace server noncompliance on structured reads 2019-04-01 08:58:04 -05:00
nbd-client.h nbd: Restrict connection_co reentrance 2019-02-25 15:03:19 +01:00
nbd.c nbd/client: Lower min_block for block-status, unaligned size 2019-03-30 20:52:19 -05:00
nfs.c block: Purify .bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
null.c block/null: Generate filename even with latency-ns 2019-02-25 15:11:27 +01:00
nvme.c block/nvme: Fix bdrv_refresh_filename() 2019-02-25 15:11:27 +01:00
parallels.c block/parallels: use buffer-based io 2019-04-30 15:29:00 +02:00
parallels.h Clean up includes 2018-02-09 05:05:11 +01:00
qapi.c qemu-img: Saner printing of large file sizes 2019-04-30 15:29:00 +02:00
qcow2-bitmap.c qcow2.h: add missing include 2019-05-28 20:30:55 +02:00
qcow2-cache.c qcow2.h: add missing include 2019-05-28 20:30:55 +02:00
qcow2-cluster.c qcow2: do encryption in threads 2019-05-28 20:30:55 +02:00
qcow2-refcount.c qcow2.h: add missing include 2019-05-28 20:30:55 +02:00
qcow2-snapshot.c qcow2.h: add missing include 2019-05-28 20:30:55 +02:00
qcow2-threads.c qcow2: do encryption in threads 2019-05-28 20:30:55 +02:00
qcow2.c qcow2: do encryption in threads 2019-05-28 20:30:55 +02:00
qcow2.h qcow2: do encryption in threads 2019-05-28 20:30:55 +02:00
qcow.c block/qcow: use buffer-based io 2019-04-30 15:29:00 +02:00
qed-check.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed-cluster.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-l2-cache.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-table.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed.h block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
quorum.c block: Make bdrv_root_attach_child() unref child_bs on failure 2019-05-28 20:30:55 +02:00
raw-format.c block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers 2019-03-26 11:37:51 +01:00
rbd.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
replication.c block: Make bdrv_{copy_on_read,crypto_luks,replication} static 2019-03-19 15:49:29 +01:00
sheepdog.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
snapshot.c block/snapshot: remove bdrv_snapshot_delete_by_id_or_name 2019-02-25 15:03:18 +01:00
ssh.c block/ssh: Implement .bdrv_dirname() 2019-05-07 17:14:21 +02:00
stream.c block/stream: use buffer-based io 2019-04-30 15:29:00 +02:00
throttle-groups.c throttle-groups: fix restart coroutine iothread race 2019-01-24 10:02:28 +00:00
throttle.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
trace-events block/ssh: Do not report read/write/flush errors to the user 2019-04-17 21:21:49 +02:00
vdi.c vdi: Replace bdrv_{read,write}() with bdrv_{pread,pwrite}() 2019-05-10 16:45:40 +02:00
vhdx-endian.c block/vhdx: Don't take address of fields in packed structs 2018-11-05 15:09:54 +01:00
vhdx-log.c block/vhdx: Use IEC binary prefixes for size constants 2019-04-30 15:29:00 +02:00
vhdx.c block/vhdx: Use IEC binary prefixes for size constants 2019-04-30 15:29:00 +02:00
vhdx.h block/vhdx: Use IEC binary prefixes for size constants 2019-04-30 15:29:00 +02:00
vmdk.c vmdk: Set vmdk parent backing_format to vmdk 2019-04-30 15:29:00 +02:00
vpc.c vpc: unlock Coroutine lock to make IO submit Concurrently 2019-04-30 15:29:00 +02:00
vvfat.c vvfat: Replace bdrv_{read,write}() with bdrv_{pread,pwrite}() 2019-05-10 16:45:40 +02:00
vxhs.c block: Add strong_runtime_opts to BlockDriver 2019-02-25 15:11:27 +01:00
win32-aio.c file-win32: Switch to byte-based callbacks 2018-05-15 16:11:41 +02:00
write-threshold.c qapi: Drop qapi_event_send_FOO()'s Error ** argument 2018-08-28 18:21:38 +02:00