summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--virt/kvm/pfncache.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c
index e05a6a1b8eff..40cbe90d52e0 100644
--- a/virt/kvm/pfncache.c
+++ b/virt/kvm/pfncache.c
@@ -206,6 +206,14 @@ int kvm_gfn_to_pfn_cache_refresh(struct kvm *kvm, struct gfn_to_pfn_cache *gpc,
if (gpc->usage & KVM_HOST_USES_PFN) {
if (new_pfn == old_pfn) {
+ /*
+ * Reuse the existing pfn and khva, but put the
+ * reference acquired hva_to_pfn_retry(); the
+ * cache still holds a reference to the pfn
+ * from the previous refresh.
+ */
+ gpc_release_pfn_and_khva(kvm, new_pfn, NULL);
+
new_khva = old_khva;
old_pfn = KVM_PFN_ERR_FAULT;
old_khva = NULL;