On Mon, Nov 27, 2023 at 05:25:46PM -0300, Fabiano Rosas wrote: > Make sure the data is flushed to disk before closing file > channels. This will ensure data is on disk at the end of a migration > to file. > > Signed-off-by: Fabiano Rosas <faro...@suse.de> > --- > io/channel-file.c | 5 +++++ > 1 file changed, 5 insertions(+)
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> Acked-by: Daniel P. Berrangé <berra...@redhat.com> > > diff --git a/io/channel-file.c b/io/channel-file.c > index a6ad7770c6..d4706fa592 100644 > --- a/io/channel-file.c > +++ b/io/channel-file.c > @@ -242,6 +242,11 @@ static int qio_channel_file_close(QIOChannel *ioc, > { > QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc); > > + if (qemu_fdatasync(fioc->fd) < 0) { > + error_setg_errno(errp, errno, > + "Unable to synchronize file data with storage > device"); > + return -1; > + } > if (qemu_close(fioc->fd) < 0) { > error_setg_errno(errp, errno, > "Unable to close file"); > -- > 2.35.3 > With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|