diff mbox

[V2,4/5] block: package rolling back code in qmp_transaction()

Message ID 1365851501-3037-5-git-send-email-xiawenc@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wayne Xia April 13, 2013, 11:11 a.m. UTC
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 blockdev.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Comments

Eric Blake April 16, 2013, 3:27 p.m. UTC | #1
On 04/13/2013 05:11 AM, Wenchao Xia wrote:

In the subject: s/rolling back/rollback/

> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  blockdev.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)

With the subject fix, feel free to add:

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

Patch

diff --git a/blockdev.c b/blockdev.c
index 38cb7d5..3e69569 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -889,6 +889,14 @@  static void external_snapshot_commit(BlockdevAction *action,
                 NULL);
 }
 
+static void external_snapshot_rollback(BlockdevAction *action,
+                                       BlkTransactionStates *states)
+{
+    if (states->new_bs) {
+        bdrv_delete(states->new_bs);
+    }
+}
+
 /*
  * 'Atomic' group snapshots.  The snapshots are taken as a set, and if any fail
  *  then we do not pivot any of the devices in the group, and abandon the
@@ -943,9 +951,7 @@  delete_and_fail:
     * the original bs for all images
     */
     QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
-        if (states->new_bs) {
-             bdrv_delete(states->new_bs);
-        }
+        external_snapshot_rollback(NULL, states);
     }
 exit:
     QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) {