xen/21128-domain-save-flush.patch

32 lines
1016 B
Diff
Raw Normal View History

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1271053336 -3600
# Node ID b5f9c6274d917db5bbe6cb9cc0d59910cc07a8a6
# Parent 5bc70100b514d98bd3938cdeca1e182726c26df2
libxc: Flush I/O before xc_domain_save completion
The final, flushing call to discard_file_cache also discards any
errors from fsync. Call fsync explicitly before leaving, to check if
all VM memory actually made it to the disk.
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Index: xen-4.0.0-testing/tools/libxc/xc_domain_save.c
===================================================================
--- xen-4.0.0-testing.orig/tools/libxc/xc_domain_save.c
+++ xen-4.0.0-testing/tools/libxc/xc_domain_save.c
@@ -1764,6 +1764,13 @@ int xc_domain_save(int xc_handle, int io
goto out;
}
+ /* Flush last write and check for errors. */
+ if ( fsync(io_fd) && errno != EINVAL )
+ {
+ PERROR("Error when flushing state file");
+ goto out;
+ }
+
/* Success! */
rc = 0;