direct-io.hg

changeset 15293:bf6f94206fec

[IA64] Fix xen/ia64 save/restore error recovery path.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Sun May 20 21:28:48 2007 -0600 (2007-05-20)
parents 24463758319b
children caafa45d24b3
files tools/libxc/ia64/xc_ia64_linux_restore.c tools/libxc/ia64/xc_ia64_linux_save.c
line diff
     1.1 --- a/tools/libxc/ia64/xc_ia64_linux_restore.c	Sun May 20 21:23:35 2007 -0600
     1.2 +++ b/tools/libxc/ia64/xc_ia64_linux_restore.c	Sun May 20 21:28:48 2007 -0600
     1.3 @@ -48,10 +48,11 @@ read_page(int xc_handle, int io_fd, uint
     1.4                                 PROT_READ|PROT_WRITE, pfn);
     1.5      if (mem == NULL) {
     1.6              ERROR("cannot map page");
     1.7 -	    return -1;
     1.8 +            return -1;
     1.9      }
    1.10      if (!read_exact(io_fd, mem, PAGE_SIZE)) {
    1.11              ERROR("Error when reading from state file (5)");
    1.12 +            munmap(mem, PAGE_SIZE);
    1.13              return -1;
    1.14      }
    1.15      munmap(mem, PAGE_SIZE);
    1.16 @@ -270,6 +271,7 @@ xc_domain_restore(int xc_handle, int io_
    1.17      }
    1.18      if (!read_exact(io_fd, shared_info, PAGE_SIZE)) {
    1.19              ERROR("Error when reading shared_info page");
    1.20 +            munmap(shared_info, PAGE_SIZE);
    1.21  	    goto out;
    1.22      }
    1.23  
    1.24 @@ -286,6 +288,10 @@ xc_domain_restore(int xc_handle, int io_
    1.25      /* Uncanonicalise the suspend-record frame number and poke resume rec. */
    1.26      start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    1.27                                        PROT_READ | PROT_WRITE, gmfn);
    1.28 +    if (start_info == NULL) {
    1.29 +        ERROR("cannot map start_info page");
    1.30 +        goto out;
    1.31 +    }
    1.32      start_info->nr_pages = p2m_size;
    1.33      start_info->shared_info = shared_info_frame << PAGE_SHIFT;
    1.34      start_info->flags = 0;
     2.1 --- a/tools/libxc/ia64/xc_ia64_linux_save.c	Sun May 20 21:23:35 2007 -0600
     2.2 +++ b/tools/libxc/ia64/xc_ia64_linux_save.c	Sun May 20 21:28:48 2007 -0600
     2.3 @@ -361,11 +361,13 @@ xc_domain_save(int xc_handle, int io_fd,
     2.4  
     2.5              if (!write_exact(io_fd, &N, sizeof(N))) {
     2.6                  ERROR("write: max_pfn");
     2.7 +                munmap(mem, PAGE_SIZE);
     2.8                  goto out;
     2.9              }
    2.10  
    2.11              if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
    2.12                  ERROR("Error when writing to state file (5)");
    2.13 +                munmap(mem, PAGE_SIZE);
    2.14                  goto out;
    2.15              }
    2.16              munmap(mem, PAGE_SIZE);
    2.17 @@ -470,6 +472,7 @@ xc_domain_save(int xc_handle, int io_fd,
    2.18      }
    2.19      if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
    2.20          ERROR("Error when writing privreg to state file (5)");
    2.21 +        munmap(mem, PAGE_SIZE);
    2.22          goto out;
    2.23      }
    2.24      munmap(mem, PAGE_SIZE);