aboutsummaryrefslogtreecommitdiff
path: root/block/quorum.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-12-20 22:21:17 +0100
committerKevin Wolf <kwolf@redhat.com>2017-02-28 20:40:35 +0100
commit8b2ff5291f9e39fb1c0c6c0c4321daac60aab4db (patch)
tree8c114097b7f06275d87594f120cd517e2724ee4b /block/quorum.c
parent7006c9a76119a863e5812de572841618b9540ac2 (diff)
downloadqemu-8b2ff5291f9e39fb1c0c6c0c4321daac60aab4db.zip
qemu-8b2ff5291f9e39fb1c0c6c0c4321daac60aab4db.tar.gz
qemu-8b2ff5291f9e39fb1c0c6c0c4321daac60aab4db.tar.bz2
block: Add Error argument to bdrv_attach_child()
It will have to return an error soon, so prepare the callers for it. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Acked-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block/quorum.c')
-rw-r--r--block/quorum.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/quorum.c b/block/quorum.c
index 86e2072..bdbcec6 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1032,10 +1032,17 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs,
/* We can safely add the child now */
bdrv_ref(child_bs);
- child = bdrv_attach_child(bs, child_bs, indexstr, &child_format);
+
+ child = bdrv_attach_child(bs, child_bs, indexstr, &child_format, errp);
+ if (child == NULL) {
+ s->next_child_index--;
+ bdrv_unref(child_bs);
+ goto out;
+ }
s->children = g_renew(BdrvChild *, s->children, s->num_children + 1);
s->children[s->num_children++] = child;
+out:
bdrv_drained_end(bs);
}