block: make .bdrv_close optional
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
diff --git a/block/snapshot.c b/block/snapshot.c
index f9903bc..3218a54 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -218,7 +218,9 @@
qobject_unref(file_options);
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);
bs->file = NULL;