diff options
author | Juan Quintela <quintela@redhat.com> | 2012-10-03 20:23:43 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2013-01-17 13:54:52 +0100 |
commit | 7de6a690e73967eb5bc5e72b2942a6be1fee2c20 (patch) | |
tree | 519d7e4b82065bffec894969dcba3fc438221883 /migration.c | |
parent | f7b67be36d01f8f506dc93213855b31dad17708c (diff) |
migration: move exit condition to migration thread
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r-- | migration.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/migration.c b/migration.c index 17eb27d199..651edd5166 100644 --- a/migration.c +++ b/migration.c @@ -669,12 +669,6 @@ static bool migrate_fd_put_ready(MigrationState *s, uint64_t max_size) bool last_round = false; qemu_mutex_lock_iothread(); - if (s->state != MIG_STATE_ACTIVE) { - DPRINTF("put_ready returning because of non-active state\n"); - qemu_mutex_unlock_iothread(); - return false; - } - DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); @@ -737,9 +731,17 @@ static void *buffered_file_thread(void *opaque) while (true) { int64_t current_time = qemu_get_clock_ms(rt_clock); + qemu_mutex_lock_iothread(); + if (s->state != MIG_STATE_ACTIVE) { + DPRINTF("put_ready returning because of non-active state\n"); + qemu_mutex_unlock_iothread(); + break; + } if (s->complete) { + qemu_mutex_unlock_iothread(); break; } + qemu_mutex_unlock_iothread(); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = s->bytes_xfer; uint64_t time_spent = current_time - initial_time; |