Skip to content

Commit

Permalink
block: Fix error path in bdrv_invalidate_cache()
Browse files Browse the repository at this point in the history
We can only clear BDRV_O_INCOMING if the caches were actually
invalidated.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
kevmw committed Jan 20, 2016
1 parent 09e0c77 commit 23c88b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block.c
Expand Up @@ -3272,12 +3272,14 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
bdrv_invalidate_cache(bs->file->bs, &local_err);
}
if (local_err) {
bs->open_flags |= BDRV_O_INCOMING;
error_propagate(errp, local_err);
return;
}

ret = refresh_total_sectors(bs, bs->total_sectors);
if (ret < 0) {
bs->open_flags |= BDRV_O_INCOMING;
error_setg_errno(errp, -ret, "Could not refresh total sector count");
return;
}
Expand Down

0 comments on commit 23c88b2

Please sign in to comment.