From: Daniel Stodden Subject: [PATCH] libxc: Flush I/O before xc_domain_save completion Date: Sat, 10 Apr 2010 01:01:26 -0000 Message-ID: <13337abe91dcaec26a22.1270861286@agari.van.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0814823838224897527==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Cc: '@van.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0814823838224897527== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 --===============0814823838224897527== Content-Type: text/x-patch; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fsync-domain-save.diff # HG changeset patch # User Daniel Stodden # 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. Signed-off-by: Daniel Stodden diff -r aae7cb2f1841 -r 13337abe91dc tools/libxc/xc_domain_save.c --- a/tools/libxc/xc_domain_save.c Fri Apr 09 08:54:25 2010 +0100 +++ b/tools/libxc/xc_domain_save.c Fri Apr 09 18:00:40 2010 -0700 @@ -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; --===============0814823838224897527== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0814823838224897527==--