block: make .bdrv_close optional
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
8d65a3ccfd
commit
3c005293c2
4
block.c
4
block.c
@ -3349,7 +3349,9 @@ static void bdrv_close(BlockDriverState *bs)
|
|||||||
bdrv_drain(bs); /* in case flush left pending I/O */
|
bdrv_drain(bs); /* in case flush left pending I/O */
|
||||||
|
|
||||||
if (bs->drv) {
|
if (bs->drv) {
|
||||||
bs->drv->bdrv_close(bs);
|
if (bs->drv->bdrv_close) {
|
||||||
|
bs->drv->bdrv_close(bs);
|
||||||
|
}
|
||||||
bs->drv = NULL;
|
bs->drv = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,9 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
|||||||
qobject_unref(file_options);
|
qobject_unref(file_options);
|
||||||
qdict_put_str(options, "file", bdrv_get_node_name(file));
|
qdict_put_str(options, "file", bdrv_get_node_name(file));
|
||||||
|
|
||||||
drv->bdrv_close(bs);
|
if (drv->bdrv_close) {
|
||||||
|
drv->bdrv_close(bs);
|
||||||
|
}
|
||||||
bdrv_unref_child(bs, bs->file);
|
bdrv_unref_child(bs, bs->file);
|
||||||
bs->file = NULL;
|
bs->file = NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user