diff mbox

blockdev: fix bitmap clear undo

Message ID 20170315212811.15937-1-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

John Snow March 15, 2017, 9:28 p.m. UTC
Only undo the action if we actually prepared the action.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 blockdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Eric Blake March 15, 2017, 10:14 p.m. UTC | #1
On 03/15/2017 04:28 PM, John Snow wrote:
> Only undo the action if we actually prepared the action.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  blockdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/blockdev.c b/blockdev.c
> index f1f49bd..c5b2c2c 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -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)
>
Kevin Wolf March 16, 2017, 9 a.m. UTC | #2
Am 15.03.2017 um 22:28 hat John Snow geschrieben:
> Only undo the action if we actually prepared the action.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/blockdev.c b/blockdev.c
index f1f49bd..c5b2c2c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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)