aboutsummaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:26 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 14:03:51 +0200
commit84ebe3755f88be4c3733e997641fafd050a58810 (patch)
treefe0129b8c732c7889f94166e127ee804bba064f7 /block/block-backend.c
parenta7f53e26a6f5bd64cda617cbcca118601d9a01d9 (diff)
block: Make device model's references to BlockBackend strong
Doesn't make a difference just yet, but it's the right thing to do. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: BenoƮt Canet <benoit.canet@nodalink.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index bdcbac674a..d0692b18e9 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -257,6 +257,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev)
if (blk->dev) {
return -EBUSY;
}
+ blk_ref(blk);
blk->dev = dev;
bdrv_iostatus_reset(blk->bs);
@@ -290,6 +291,7 @@ void blk_detach_dev(BlockBackend *blk, void *dev)
blk->dev_opaque = NULL;
bdrv_set_guest_block_size(blk->bs, 512);
qemu_coroutine_adjust_pool_size(-COROUTINE_POOL_RESERVATION);
+ blk_unref(blk);
}
/*