mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
iohelper: fdatasync() at the end
Currently, when we are doing (managed) save, we insert the iohelper between the qemu and OS. The pipe is created, the writing end is passed to qemu and the reading end to the iohelper. It reads data and write them into given file. However, with write() being asynchronous data may still be in OS caches and hence in some (corner) cases, all migration data may have been read and written (not physically though). So qemu will report success, as well as iohelper. However, with some non local filesystems, where ENOSPACE is polled every X time units, we may get into situation where all operations succeeded but data hasn't reached the disk. And in fact will never do. Therefore we ought sync caches to make sure data has reached the block device on remote host.
This commit is contained in:
parent
91b1c69f9f
commit
f32e3a2dd6
@ -179,6 +179,12 @@ runIO(const char *path, int fd, int oflags, unsigned long long length)
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure all data is written */
|
||||
if (fdatasync(fdout) < 0) {
|
||||
virReportSystemError(errno, _("unable to fsync %s"), fdoutname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
Loading…
x
Reference in New Issue
Block a user