aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block.c b/block.c
index e95f613aa4..2e4ddea222 100644
--- a/block.c
+++ b/block.c
@@ -1098,12 +1098,12 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
void bdrv_close(BlockDriverState *bs)
{
bdrv_flush(bs);
- if (bs->drv) {
- if (bs->job) {
- block_job_cancel_sync(bs->job);
- }
- bdrv_drain_all();
+ if (bs->job) {
+ block_job_cancel_sync(bs->job);
+ }
+ bdrv_drain_all();
+ if (bs->drv) {
if (bs == bs_snapshots) {
bs_snapshots = NULL;
}