mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
migration/file: switch file_write_ramblock_iov to pwritev_all
file_write_ramblock_iov() uses single-shot qio_channel_pwritev() and
only checks for ret < 0. A short write (0 <= ret < requested) would be
treated as success.
Switch to qio_channel_pwritev_all() which retries until all bytes are
written or an error occurs.
Fixes: f427d90b98 ("migration/multifd: Support outgoing mapped-ram stream format")
Signed-off-by: Junjie Cao <junjie.cao@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260420201317.30199-3-junjie.cao@intel.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
committed by
Fabiano Rosas
parent
e12cbfb930
commit
5e76440b56
@@ -202,7 +202,7 @@ void file_connect_incoming(FileMigrationArgs *file_args, Error **errp)
|
||||
int file_write_ramblock_iov(QIOChannel *ioc, const struct iovec *iov,
|
||||
int niov, MultiFDPages_t *pages, Error **errp)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
int ret = 0;
|
||||
int i, slice_idx, slice_num;
|
||||
uintptr_t base, next, offset;
|
||||
size_t len;
|
||||
@@ -241,8 +241,8 @@ int file_write_ramblock_iov(QIOChannel *ioc, const struct iovec *iov,
|
||||
break;
|
||||
}
|
||||
|
||||
ret = qio_channel_pwritev(ioc, &iov[slice_idx], slice_num,
|
||||
block->pages_offset + offset, errp);
|
||||
ret = qio_channel_pwritev_all(ioc, &iov[slice_idx], slice_num,
|
||||
block->pages_offset + offset, errp);
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ int file_write_ramblock_iov(QIOChannel *ioc, const struct iovec *iov,
|
||||
slice_num = 0;
|
||||
}
|
||||
|
||||
return (ret < 0) ? ret : 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multifd_file_recv_data(MultiFDRecvParams *p, Error **errp)
|
||||
|
||||
Reference in New Issue
Block a user