Skip to contentSkip to conversation

libxc: Flush I/O before xc_domain_save completion

PATCH New Daniel Stodden 1 participant 1 message Apr 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

# HG changeset patch
# User Daniel Stodden <[email protected]> # Date 1270861240 25200
# Node ID 13337abe91dcaec26a22839c5f0629d310686712 # Parent aae7cb2f18411492c720d3b60adaa979858a63df
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.

tools/libxc/xc_domain_save.c +7 -0
diff -r aae7cb2f1841 -r 13337abe91dc tools/libxc/xc_domain_save.c
@@ -1764,6 +1764,13 @@
         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;
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel