qemu-patch-raspberry4/migration
Fam Zheng a1fbe750fd 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>
2017-06-19 17:53:33 +01:00
..
block.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
block.h migration: Move include/migration/block.h into migration/ 2017-06-01 18:49:24 +02:00
channel.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
channel.h migration: Remove MigrationState from migration_channel_incomming() 2017-06-13 11:00:44 +02:00
colo-comm.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
colo-failover.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
colo.c migration: Fix race of image locking between src and dst 2017-06-19 17:53:33 +01:00
exec.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
exec.h migration: Export exec.c functions in its own file 2017-06-01 18:49:22 +02:00
fd.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
fd.h migration: Export fd.c functions in its own file 2017-06-01 18:49:22 +02:00
global_state.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
Makefile.objs migration: create global_state.c 2017-06-13 11:00:45 +02:00
migration.c migration: Fix race of image locking between src and dst 2017-06-19 17:53:33 +01:00
migration.h migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
page_cache.c migration: Move page_cache.c to migration/ 2017-05-17 12:04:59 +02:00
page_cache.h migration: Move page_cache.c to migration/ 2017-05-17 12:04:59 +02:00
postcopy-ram.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
postcopy-ram.h migration: Move postcopy stuff to postcopy-ram.c 2017-05-17 12:04:59 +02:00
qemu-file-channel.c migration: Split qemu-file.h 2017-06-01 18:49:22 +02:00
qemu-file-channel.h migration: Export qemu-file-channel.c functions in its own file 2017-05-18 19:20:50 +02:00
qemu-file.c migration: Remove unneeded includes 2017-06-14 11:10:19 +02:00
qemu-file.h migration: ram_control_* are implemented in qemu_file 2017-06-13 11:00:45 +02:00
qjson.c migration: Move qjson.h to migration/ 2017-05-18 19:20:59 +02:00
qjson.h migration: Move qjson.h to migration/ 2017-05-18 19:20:59 +02:00
ram.c migration: Don't create decompression threads if not enabled 2017-06-14 11:11:06 +02:00
ram.h ram: Use MigrationStats for statistics 2017-06-07 10:20:54 +02:00
rdma.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
rdma.h migration: Export rdma.c functions in its own file 2017-06-01 18:49:23 +02:00
savevm.c migration: Fix race of image locking between src and dst 2017-06-19 17:53:33 +01:00
savevm.h migration: Fix race of image locking between src and dst 2017-06-19 17:53:33 +01:00
socket.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
socket.h migration: Export socket.c functions in its own file 2017-06-01 18:49:23 +02:00
tls.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
tls.h migration: Export tls.c functions in its own file 2017-06-01 18:49:23 +02:00
trace-events migration: isolate return path on src 2017-06-13 11:00:44 +02:00
vmstate-types.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
vmstate.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
xbzrle.c migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00
xbzrle.h migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00