debuggers.hg

changeset 21174:b5f9c6274d91

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>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 12 07:22:16 2010 +0100 (2010-04-12)
parents 5bc70100b514
children bf74d9c31674
files tools/libxc/xc_domain_save.c
line diff
     1.1 --- a/tools/libxc/xc_domain_save.c	Mon Apr 12 07:21:44 2010 +0100
     1.2 +++ b/tools/libxc/xc_domain_save.c	Mon Apr 12 07:22:16 2010 +0100
     1.3 @@ -1764,6 +1764,13 @@ int xc_domain_save(int xc_handle, int io
     1.4          goto out;
     1.5      }
     1.6  
     1.7 +    /* Flush last write and check for errors. */
     1.8 +    if ( fsync(io_fd) && errno != EINVAL )
     1.9 +    {
    1.10 +        PERROR("Error when flushing state file");
    1.11 +        goto out;
    1.12 +    }
    1.13 +
    1.14      /* Success! */
    1.15      rc = 0;
    1.16