diff options
-rw-r--r-- | block/qcow2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index 0f8c485c2c..fd8436c5f8 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1764,6 +1764,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp) bdrv_invalidate_cache(bs->file->bs, &local_err); if (local_err) { error_propagate(errp, local_err); + bs->drv = NULL; return; } @@ -1776,9 +1777,11 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp) if (local_err) { error_propagate(errp, local_err); error_prepend(errp, "Could not reopen qcow2 layer: "); + bs->drv = NULL; return; } else if (ret < 0) { error_setg_errno(errp, -ret, "Could not reopen qcow2 layer"); + bs->drv = NULL; return; } |