io: fsync before closing a file channel
authorFabiano Rosas <farosas@suse.de>
Thu, 29 Feb 2024 15:29:59 +0000 (12:29 -0300)
committerPeter Xu <peterx@redhat.com>
Fri, 1 Mar 2024 07:42:04 +0000 (15:42 +0800)
commitc05dfcb7f2c5e39fc47c347de305df4e6afb4fa9
tree81260a1275b385de671dc652e0a0757ff7e475e7
parent0478b030fa2530cbbfc4d6432e8e39a16d06865b
io: fsync before closing a file channel

Make sure the data is flushed to disk before closing file
channels. This is to ensure data is on disk and not lost in the event
of a host crash.

This is currently being implemented to affect the migration code when
migrating to a file, but all QIOChannelFile users should benefit from
the change.

Reviewed-by: "Daniel P. Berrangé" <berrange@redhat.com>
Acked-by: "Daniel P. Berrangé" <berrange@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240229153017.2221-6-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
io/channel-file.c