Revision f67503e5 block/qcow2.c
b/block/qcow2.c | ||
---|---|---|
1543 | 1543 |
goto out; |
1544 | 1544 |
} |
1545 | 1545 |
|
1546 |
bdrv_close(bs); |
|
1546 |
bdrv_unref(bs); |
|
1547 |
bs = NULL; |
|
1547 | 1548 |
|
1548 | 1549 |
/* |
1549 | 1550 |
* And now open the image and make it consistent first (i.e. increase the |
... | ... | |
1552 | 1553 |
*/ |
1553 | 1554 |
BlockDriver* drv = bdrv_find_format("qcow2"); |
1554 | 1555 |
assert(drv != NULL); |
1555 |
ret = bdrv_open(bs, filename, NULL, |
|
1556 |
ret = bdrv_open(&bs, filename, NULL,
|
|
1556 | 1557 |
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, drv, &local_err); |
1557 | 1558 |
if (ret < 0) { |
1558 | 1559 |
error_propagate(errp, local_err); |
... | ... | |
1599 | 1600 |
} |
1600 | 1601 |
} |
1601 | 1602 |
|
1602 |
bdrv_close(bs); |
|
1603 |
bdrv_unref(bs); |
|
1604 |
bs = NULL; |
|
1603 | 1605 |
|
1604 | 1606 |
/* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning */ |
1605 |
ret = bdrv_open(bs, filename, NULL, |
|
1607 |
ret = bdrv_open(&bs, filename, NULL,
|
|
1606 | 1608 |
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING, |
1607 | 1609 |
drv, &local_err); |
1608 | 1610 |
if (local_err) { |
... | ... | |
1612 | 1614 |
|
1613 | 1615 |
ret = 0; |
1614 | 1616 |
out: |
1615 |
bdrv_unref(bs); |
|
1617 |
if (bs) { |
|
1618 |
bdrv_unref(bs); |
|
1619 |
} |
|
1616 | 1620 |
return ret; |
1617 | 1621 |
} |
1618 | 1622 |
|
Also available in: Unified diff