]> www.infradead.org Git - users/dwmw2/qemu.git/commit
migration/block: Fix possible race with block_inactive
authorPeter Xu <peterx@redhat.com>
Fri, 6 Dec 2024 23:08:37 +0000 (18:08 -0500)
committerFabiano Rosas <farosas@suse.de>
Thu, 9 Jan 2025 20:38:54 +0000 (17:38 -0300)
commit8c97c5a476d146b35b2873ef73df601216a494d9
tree4f91160bbb436de48c97ce29b60ddf1dc03e3ead
parent61f2b489987c51159c53101a072c6aa901b50506
migration/block: Fix possible race with block_inactive

Src QEMU sets block_inactive=true very early before the invalidation takes
place.  It means if something wrong happened during setting the flag but
before reaching qemu_savevm_state_complete_precopy_non_iterable() where it
did the invalidation work, it'll make block_inactive flag inconsistent.

For example, think about when qemu_savevm_state_complete_precopy_iterable()
can fail: it will have block_inactive set to true even if all block drives
are active.

Fix that by only update the flag after the invalidation is done.

No Fixes for any commit, because it's not an issue if bdrv_activate_all()
is re-entrant upon all-active disks - false positive block_inactive can
bring nothing more than "trying to active the blocks but they're already
active".  However let's still do it right to avoid the inconsistent flag
v.s. reality.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-Id: <20241206230838.1111496-6-peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
migration/migration.c
migration/savevm.c