From: David Vrabel <david.vrabel@citrix.com>
Date: Thu, 30 Aug 2012 12:58:11 +0000 (+0100)
Subject: xen/mm: return more precise error from xen_remap_domain_range()
X-Git-Tag: v3.7-rc1~128^2~14
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=69870a847856a1ba81f655a8633fce5f5b614730;p=users%2Fjedix%2Flinux-maple.git

xen/mm: return more precise error from xen_remap_domain_range()

Callers of xen_remap_domain_range() need to know if the remap failed
because frame is currently paged out.  So they can retry the remap
later on.  Return -ENOENT in this case.

This assumes that the error codes returned by Xen are a subset of
those used by the kernel.  It is unclear if this is defined as part of
the hypercall ABI.

Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 885a22354a96..2d9e7c9c0e7b 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -2331,8 +2331,8 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
 		if (err)
 			goto out;
 
-		err = -EFAULT;
-		if (HYPERVISOR_mmu_update(mmu_update, batch, NULL, domid) < 0)
+		err = HYPERVISOR_mmu_update(mmu_update, batch, NULL, domid);
+		if (err < 0)
 			goto out;
 
 		nr -= batch;