aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_linux_osdep.c
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2012-01-27 18:32:55 +0000
committerOlaf Hering <olaf@aepfle.de>2012-01-27 18:32:55 +0000
commit3fb8faf59e30206d45977e2908c2032d6ec3b3f0 (patch)
treeec162e68e4121ae50a0483924ca5b04e4db1adce /tools/libxc/xc_linux_osdep.c
parent1da3983b7db55f506d0764888aabf8001736f98f (diff)
downloadxen-3fb8faf59e30206d45977e2908c2032d6ec3b3f0.tar.gz
xen-3fb8faf59e30206d45977e2908c2032d6ec3b3f0.tar.bz2
xen-3fb8faf59e30206d45977e2908c2032d6ec3b3f0.zip
tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly
If the first ioctl fails with ENOENT it means the command is known. If a second attempt to map each gfn happens to fail then there is no need to run the fallback code. Some gfns are paged and the fallback code would not fix the failure. Instead return the EINVAL to the caller. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_linux_osdep.c')
-rw-r--r--tools/libxc/xc_linux_osdep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
index 319997947e..02df9c5ba0 100644
--- a/tools/libxc/xc_linux_osdep.c
+++ b/tools/libxc/xc_linux_osdep.c
@@ -217,6 +217,7 @@ static void *linux_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h
rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
+ /* Command was recognized, some gfn in arr are in paging state */
if ( rc < 0 && errno == ENOENT )
{
for ( i = rc = 0; rc == 0 && i < num; i++ )
@@ -235,8 +236,8 @@ static void *linux_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h
} while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
}
}
-
- if ( rc < 0 && errno == EINVAL && (int)num > 0 )
+ /* Command was not recognized, use fall back */
+ else if ( rc < 0 && errno == EINVAL && (int)num > 0 )
{
/*
* IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to