aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-01-16 10:16:14 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-01-16 10:16:14 +0000
commite68cba36360a2ab5bf0576b66df4d0eb0d822f8d (patch)
tree933ecff5cc8e380fe38693dc0cca2d7b8e479dfc /migration/migration.c
parentdf58887b20fab8fe8a6dcca4db30cd4e4077d53a (diff)
parentea987c2c21d4326bb58ee28f6888fdcf8fbda067 (diff)
downloadqemu-e68cba36360a2ab5bf0576b66df4d0eb0d822f8d.zip
qemu-e68cba36360a2ab5bf0576b66df4d0eb0d822f8d.tar.gz
qemu-e68cba36360a2ab5bf0576b66df4d0eb0d822f8d.tar.bz2
Merge remote-tracking branch 'remotes/amit-migration/tags/mig-2.3-1' into staging
A set of patches collected over the holidays. Mix of optimizations and fixes. # gpg: Signature made Fri 16 Jan 2015 07:42:00 GMT using RSA key ID 854083B6 # gpg: Good signature from "Amit Shah <amit@amitshah.net>" # gpg: aka "Amit Shah <amit@kernel.org>" # gpg: aka "Amit Shah <amitshah@gmx.net>" * remotes/amit-migration/tags/mig-2.3-1: vmstate: type-check sub-arrays migration_cancel: shutdown migration socket Handle bi-directional communication for fd migration socket shutdown Tests: QEMUSizedBuffer/QEMUBuffer QEMUSizedBuffer: only free qsb that qemu_bufopen allocated xbzrle: rebuild the cache_is_cached function xbzrle: optimize XBZRLE to decrease the cache misses Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c
index c49a05a..b3adbc6 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -330,6 +330,7 @@ void migrate_fd_error(MigrationState *s)
static void migrate_fd_cancel(MigrationState *s)
{
int old_state ;
+ QEMUFile *f = migrate_get_current()->file;
trace_migrate_fd_cancel();
do {
@@ -339,6 +340,17 @@ static void migrate_fd_cancel(MigrationState *s)
}
migrate_set_state(s, old_state, MIG_STATE_CANCELLING);
} while (s->state != MIG_STATE_CANCELLING);
+
+ /*
+ * If we're unlucky the migration code might be stuck somewhere in a
+ * send/write while the network has failed and is waiting to timeout;
+ * if we've got shutdown(2) available then we can force it to quit.
+ * The outgoing qemu file gets closed in migrate_fd_cleanup that is
+ * called in a bh, so there is no race against this cancel.
+ */
+ if (s->state == MIG_STATE_CANCELLING && f) {
+ qemu_file_shutdown(f);
+ }
}
void add_migration_state_change_notifier(Notifier *notify)