migration: Postpone releasing MigrationState.hostname
authorPeter Xu <peterx@redhat.com>
Thu, 31 Mar 2022 15:08:39 +0000 (11:08 -0400)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Thu, 21 Apr 2022 18:36:46 +0000 (19:36 +0100)
We used to release it right after migrate_fd_connect().  That's not good
enough when there're more than one socket pair required, because it'll be
needed to establish TLS connection for the rest channels.

One example is multifd, where we copied over the hostname for each channel
but that's actually not needed.

Keeping the hostname until the cleanup phase of migration.

Cc: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220331150857.74406-2-peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  dgilbert: Fixup checkpatch error; don't need to check for NULL
  around g_free

migration/channel.c
migration/migration.c

index c4fc000a1a0a7986402dba577c55045bc86b72d3..c6a8dcf1d70bc246804968922700208c227ebdb9 100644 (file)
@@ -96,6 +96,5 @@ void migration_channel_connect(MigrationState *s,
         }
     }
     migrate_fd_connect(s, error);
-    g_free(s->hostname);
     error_free(error);
 }
index 4dcb511bb60da150158c0baea07c1df79843435d..3f61a08752e47cbb2f6dc4bf7a71922335b6495a 100644 (file)
@@ -1809,6 +1809,9 @@ static void migrate_fd_cleanup(MigrationState *s)
     qemu_bh_delete(s->cleanup_bh);
     s->cleanup_bh = NULL;
 
+    g_free(s->hostname);
+    s->hostname = NULL;
+
     qemu_savevm_state_cleanup();
 
     if (s->to_dst_file) {