]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
monitor: add missed aio_context_acquire into vm_completion call
authorDenis V. Lunev <den@openvz.org>
Wed, 4 Nov 2015 17:19:42 +0000 (20:19 +0300)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 9 Nov 2015 10:07:10 +0000 (10:07 +0000)
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Luiz Capitulino <lcapitulino@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
monitor.c

index 6cd747f4f96cc77d785f65f93c21be37d7d93890..32958407dde54f423032de318f4669ad6eec5d0e 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -3408,13 +3408,18 @@ static void vm_completion(ReadLineState *rs, const char *str)
     readline_set_completion_index(rs, len);
     while ((bs = bdrv_next(bs))) {
         SnapshotInfoList *snapshots, *snapshot;
+        AioContext *ctx = bdrv_get_aio_context(bs);
+        bool ok = false;
 
-        if (!bdrv_can_snapshot(bs)) {
-            continue;
+        aio_context_acquire(ctx);
+        if (bdrv_can_snapshot(bs)) {
+            ok = bdrv_query_snapshot_info_list(bs, &snapshots, NULL) == 0;
         }
-        if (bdrv_query_snapshot_info_list(bs, &snapshots, NULL)) {
+        aio_context_release(ctx);
+        if (!ok) {
             continue;
         }
+
         snapshot = snapshots;
         while (snapshot) {
             char *completion = snapshot->value->name;