diff options
author | Fam Zheng <famz@redhat.com> | 2017-06-17 00:06:58 +0800 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-06-19 17:53:33 +0100 |
commit | a1fbe750fd90d29309fd037ab98f263367aaf770 (patch) | |
tree | de9cc0359329d19d71526483a60b7eb688b16c27 /migration/savevm.h | |
parent | edf8bc98424d62035d5e4c0f39542722d72d7979 (diff) | |
download | qemu-a1fbe750fd90d29309fd037ab98f263367aaf770.zip qemu-a1fbe750fd90d29309fd037ab98f263367aaf770.tar.gz qemu-a1fbe750fd90d29309fd037ab98f263367aaf770.tar.bz2 |
migration: Fix race of image locking between src and dst
Previously, dst side will immediately try to lock the write byte upon
receiving QEMU_VM_EOF, but at src side, bdrv_inactivate_all() is only
done after sending it. If the src host is under load, dst may fail to
acquire the lock due to racing with the src unlocking it.
Fix this by hoisting the bdrv_inactivate_all() operation before
QEMU_VM_EOF.
N.B. A further improvement could possibly be done to cleanly handover
locks between src and dst, so that there is no window where a third QEMU
could steal the locks and prevent src and dst from running.
N.B. This commit includes a minor improvement to the error handling
by using qemu_file_set_error().
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20170616160658.32290-1-famz@redhat.com
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[PMM: noted qemu_file_set_error() use in commit as suggested by Daniel]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/savevm.h')
-rw-r--r-- | migration/savevm.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/migration/savevm.h b/migration/savevm.h index 45b59c1..5a2ed11 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -35,7 +35,8 @@ void qemu_savevm_state_header(QEMUFile *f); int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy); void qemu_savevm_state_cleanup(void); void qemu_savevm_state_complete_postcopy(QEMUFile *f); -void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only); +int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only, + bool inactivate_disks); void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size, uint64_t *res_non_postcopiable, uint64_t *res_postcopiable); |