On 11/06/2015 05:09 PM, Stefan Hajnoczi wrote:
On Wed, Nov 04, 2015 at 08:19:34PM +0300, Denis V. Lunev wrote:
to delete snapshots from all loaded block drivers.

The patch also ensures proper locking.

Signed-off-by: Denis V. Lunev <d...@openvz.org>
CC: Juan Quintela <quint...@redhat.com>
CC: Stefan Hajnoczi <stefa...@redhat.com>
CC: Kevin Wolf <kw...@redhat.com>
---
  block/snapshot.c         | 22 ++++++++++++++++++++
  include/block/snapshot.h |  2 ++
  migration/savevm.c       | 54 +++++++++---------------------------------------
  3 files changed, 34 insertions(+), 44 deletions(-)

diff --git a/block/snapshot.c b/block/snapshot.c
index d729c76..1b4b846 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -384,3 +384,25 @@ bool bdrv_all_can_snapshot(BlockDriverState **first_bad_bs)
      *first_bad_bs = bs;
      return ok;
  }
+
+int bdrv_all_delete_snapshot(const char *name, BlockDriverState **first_bad_bs,
+                             Error **err)
+{
+    int ret = 0;
+    BlockDriverState *bs = NULL;
+    QEMUSnapshotInfo sn1, *snapshot = &sn1;
+
+    while ((bs = bdrv_next(bs)) && ret == 0) {
If ret != 0 we will iterate to the next bs.  first_bad_bs will be
incorrect.
good catch! this applies as well to all patches below.
You don't need to point this again :)

Reply via email to