qemu/migration
Fabiano Rosas 5d9f2461b4 migration: Fix file migration with fdset
When the "file:" migration support was added we missed the special
case in the qemu_open_old implementation that allows for a particular
file name format to be used to refer to a set of file descriptors that
have been previously provided to QEMU via the add-fd QMP command.

When using this fdset feature, we should not truncate the migration
file because being given an fd means that the management layer is in
control of the file and will likely already have some data written to
it. This is further indicated by the presence of the 'offset'
argument, which indicates the start of the region where QEMU is
allowed to write.

Fix the issue by replacing the O_TRUNC flag on open by an ftruncate
call, which will take the offset into consideration.

Fixes: 385f510df5 ("migration: file URI offset")
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 6d3279655a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: context fixup in migration/file.c due to missing
 v8.2.0-1958-gb7b03eb614d0 "migration/multifd: Add outgoing QIOChannelFile support")
2024-06-30 15:04:18 +03:00
..
block-dirty-bitmap.c block: Mark bdrv_filter_bs() and callers GRAPH_RDLOCK 2023-11-07 19:14:19 +01:00
block.c migration: Skip only empty block devices 2024-03-19 19:22:46 +03:00
block.h
channel-block.c
channel-block.h
channel.c
channel.h
colo-failover.c
colo.c migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_coroutine()' failed. 2024-04-28 15:42:40 +03:00
dirtyrate.c
dirtyrate.h
exec.c migration: convert exec backend to accept MigrateAddress. 2023-11-02 11:35:04 +01:00
exec.h migration: convert exec backend to accept MigrateAddress. 2023-11-02 11:35:04 +01:00
fd.c
fd.h
file.c migration: Fix file migration with fdset 2024-06-30 15:04:18 +03:00
file.h migration: Convert the file backend to the new QAPI syntax 2023-11-02 11:35:04 +01:00
global_state.c
meson.build
migration-hmp-cmds.c migration: Plug memory leak on HMP migrate error path 2024-01-29 23:00:39 +03:00
migration-stats.c
migration-stats.h
migration.c migration/postcopy: Ensure postcopy_start() sets errp if it fails 2024-04-01 19:30:21 +03:00
migration.h migration: Implement MigrateChannelList to hmp migration flow. 2023-11-02 11:35:04 +01:00
multifd-zlib.c
multifd-zstd.c
multifd.c migration/multifd: Stop setting p->ioc before connecting 2023-11-30 09:50:10 +01:00
multifd.h
options.c
options.h
page_cache.c
page_cache.h
postcopy-ram.c
postcopy-ram.h
qemu-file.c
qemu-file.h
ram-compress.c
ram-compress.h
ram.c migration: Unlock mutex in error case 2023-11-03 10:48:37 +01:00
ram.h
rdma.c migration/rdma: Fix a memory issue for migration 2024-03-12 20:43:32 +03:00
rdma.h
savevm.c migration/postcopy: ensure preempt channel is ready before loading states 2024-04-09 20:18:26 +03:00
savevm.h
socket.c
socket.h
target.c
threadinfo.c
threadinfo.h
tls.c
tls.h
trace-events
trace.h
vmstate-types.c
vmstate.c
xbzrle.c
xbzrle.h
yank_functions.c
yank_functions.h