]> git.ipfire.org Git - thirdparty/qemu.git/commit
migration: Cleanup migrate_fd_cleanup() on accessing to_dst_file
authorPeter Xu <peterx@redhat.com>
Thu, 19 Sep 2024 16:30:42 +0000 (12:30 -0400)
committerPeter Xu <peterx@redhat.com>
Thu, 31 Oct 2024 19:48:18 +0000 (15:48 -0400)
commit6dd4f44c4f6b1046e5ceb593b9ab4f8fbb92f028
treee9dc06cd3ccc8c9b56297d410105ec30e2a86f86
parentea8ae47bdd2024dc2596f16b27f27fd4dcc08776
migration: Cleanup migrate_fd_cleanup() on accessing to_dst_file

The cleanup function can in many cases needs cleanup on its own.

The major thing we want to do here is not referencing to_dst_file when
without the file mutex.  When at it, touch things elsewhere too to make it
look slightly better in general.

One thing to mention is, migration_thread has its own "running" boolean, so
it doesn't need to rely on to_dst_file being non-NULL.  Multifd has a
dependency so it needs to be skipped if to_dst_file is not yet set; add a
richer comment for such reason.

Resolves: Coverity CID 1527402
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240919163042.116767-1-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
migration/migration.c