diff mbox

[03/10] migration: added missed aio_context_acquire around bdrv_snapshot_delete

Message ID 1446559933-28965-4-git-send-email-den@openvz.org
State New
Headers show

Commit Message

Denis V. Lunev Nov. 3, 2015, 2:12 p.m. UTC
Necessary for bdrv_drain to run properly.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Amit Shah <amit.shah@redhat.com>
---
 migration/savevm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Juan Quintela Nov. 3, 2015, 2:51 p.m. UTC | #1
"Denis V. Lunev" <den@openvz.org> wrote:
> Necessary for bdrv_drain to run properly.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Juan Quintela <quintela@redhat.com>
> CC: Amit Shah <amit.shah@redhat.com>
> ---

See comments on previous thread just posted.

Last Stefan suggestion was to move this code to snapshot.c, and then you
don't need to convince migration folks of anything O:-)


>  migration/savevm.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 1653f56..f45ff63 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1273,7 +1273,12 @@ static int del_existing_snapshots(Monitor *mon, const char *name)
>      while ((bs = bdrv_next(bs))) {
>          if (bdrv_can_snapshot(bs) &&
>              bdrv_snapshot_find(bs, snapshot, name) >= 0) {
> +            AioContext *ctx = bdrv_get_aio_context(bs);
> +
> +            aio_context_acquire(ctx);
>              bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
> +            aio_context_release(ctx);
> +
>              if (err) {
>                  monitor_printf(mon,
>                                 "Error while deleting snapshot on device '%s':"
> @@ -1518,8 +1523,13 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
>      bs = NULL;
>      while ((bs = bdrv_next(bs))) {
>          if (bdrv_can_snapshot(bs)) {
> +            AioContext *ctx = bdrv_get_aio_context(bs);
> +
>              err = NULL;
> +            aio_context_acquire(ctx);
>              bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
> +            aio_context_release(ctx);
> +
>              if (err) {
>                  monitor_printf(mon,
>                                 "Error while deleting snapshot on device '%s':"
diff mbox

Patch

diff --git a/migration/savevm.c b/migration/savevm.c
index 1653f56..f45ff63 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1273,7 +1273,12 @@  static int del_existing_snapshots(Monitor *mon, const char *name)
     while ((bs = bdrv_next(bs))) {
         if (bdrv_can_snapshot(bs) &&
             bdrv_snapshot_find(bs, snapshot, name) >= 0) {
+            AioContext *ctx = bdrv_get_aio_context(bs);
+
+            aio_context_acquire(ctx);
             bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
+            aio_context_release(ctx);
+
             if (err) {
                 monitor_printf(mon,
                                "Error while deleting snapshot on device '%s':"
@@ -1518,8 +1523,13 @@  void hmp_delvm(Monitor *mon, const QDict *qdict)
     bs = NULL;
     while ((bs = bdrv_next(bs))) {
         if (bdrv_can_snapshot(bs)) {
+            AioContext *ctx = bdrv_get_aio_context(bs);
+
             err = NULL;
+            aio_context_acquire(ctx);
             bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
+            aio_context_release(ctx);
+
             if (err) {
                 monitor_printf(mon,
                                "Error while deleting snapshot on device '%s':"