carlwgeorge / rpms / qemu

Forked from rpms/qemu a year ago
Clone
a7b9285
From 2b2c8310a60981dfe3bb37cdd007016f285d1b8a Mon Sep 17 00:00:00 2001
Alon Levy 408bdb5
From: Paolo Bonzini <pbonzini@redhat.com>
Alon Levy 408bdb5
Date: Fri, 22 Feb 2013 17:36:46 +0100
a7b9285
Subject: [PATCH] migration: move contents of migration_close to
Alon Levy 408bdb5
 migrate_fd_cleanup
Alon Levy 408bdb5
Alon Levy 408bdb5
With this patch, the migration_file is not needed anymore.
Alon Levy 408bdb5
Alon Levy 408bdb5
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Alon Levy 408bdb5
Reviewed-by: Juan Quintela <quintela@redhat.com>
Alon Levy 408bdb5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Alon Levy 408bdb5
Signed-off-by: Juan Quintela <quintela@redhat.com>
a7b9285
(cherry picked from commit 404a7c05bcc20c51fe1a9bf2deaeb4d6b658d3a3)
Alon Levy 408bdb5
---
Alon Levy 408bdb5
 migration.c | 17 +++++++----------
Alon Levy 408bdb5
 1 file changed, 7 insertions(+), 10 deletions(-)
Alon Levy 408bdb5
Alon Levy 408bdb5
diff --git a/migration.c b/migration.c
Alon Levy 408bdb5
index ea84008..949a5bc 100644
Alon Levy 408bdb5
--- a/migration.c
Alon Levy 408bdb5
+++ b/migration.c
Alon Levy 408bdb5
@@ -272,6 +272,12 @@ static void migrate_fd_cleanup(void *opaque)
Alon Levy 408bdb5
         DPRINTF("closing file\n");
Alon Levy 408bdb5
         qemu_fclose(s->file);
Alon Levy 408bdb5
         s->file = NULL;
Alon Levy 408bdb5
+
Alon Levy 408bdb5
+        qemu_mutex_unlock_iothread();
Alon Levy 408bdb5
+        qemu_thread_join(&s->thread);
Alon Levy 408bdb5
+        qemu_mutex_lock_iothread();
Alon Levy 408bdb5
+
Alon Levy 408bdb5
+        migrate_fd_close(s);
Alon Levy 408bdb5
     }
Alon Levy 408bdb5
 
Alon Levy 408bdb5
     assert(s->migration_file == NULL);
Alon Levy 408bdb5
@@ -523,16 +529,7 @@ static int migration_put_buffer(void *opaque, const uint8_t *buf,
Alon Levy 408bdb5
 
Alon Levy 408bdb5
 static int migration_close(void *opaque)
Alon Levy 408bdb5
 {
Alon Levy 408bdb5
-    MigrationState *s = opaque;
Alon Levy 408bdb5
-
Alon Levy 408bdb5
-    DPRINTF("closing\n");
Alon Levy 408bdb5
-
Alon Levy 408bdb5
-    qemu_mutex_unlock_iothread();
Alon Levy 408bdb5
-    qemu_thread_join(&s->thread);
Alon Levy 408bdb5
-    qemu_mutex_lock_iothread();
Alon Levy 408bdb5
-    assert(s->state != MIG_STATE_ACTIVE);
Alon Levy 408bdb5
-
Alon Levy 408bdb5
-    return migrate_fd_close(s);
Alon Levy 408bdb5
+    return 0;
Alon Levy 408bdb5
 }
Alon Levy 408bdb5
 
Alon Levy 408bdb5
 static int migration_get_fd(void *opaque)