]> Git Repo - qemu.git/commitdiff
migration_cancel: shutdown migration socket
authorDr. David Alan Gilbert <[email protected]>
Thu, 8 Jan 2015 11:11:32 +0000 (11:11 +0000)
committerAmit Shah <[email protected]>
Fri, 16 Jan 2015 07:36:17 +0000 (13:06 +0530)
Force shutdown on migration socket on cancel to cause the cancel
to complete even if the socket is blocked on a dead network.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Amit Shah <[email protected]>
Signed-off-by: Amit Shah <[email protected]>
migration/migration.c

index c49a05a16595993ca255eb7b1b84519b31e5fa2c..b3adbc653a0071fa971a86d768a97315289c2a2c 100644 (file)
@@ -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)
This page took 0.026551 seconds and 4 git commands to generate.