blockdev: fix bitmap clear undo

Only undo the action if we actually prepared the action.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
John Snow 2017-03-15 17:28:11 -04:00 committed by Kevin Wolf
parent c1cef67251
commit 184dd9c49b

View File

@ -2047,7 +2047,9 @@ static void block_dirty_bitmap_clear_abort(BlkActionState *common)
BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
common, common);
bdrv_undo_clear_dirty_bitmap(state->bitmap, state->backup);
if (state->backup) {
bdrv_undo_clear_dirty_bitmap(state->bitmap, state->backup);
}
}
static void block_dirty_bitmap_clear_commit(BlkActionState *common)