Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 087ffecd authored by Roger Pau Monne's avatar Roger Pau Monne Committed by Konrad Rzeszutek Wilk
Browse files

xen-blkback: use balloon pages for persistent grants



With current persistent grants implementation we are not freeing the
persistent grants after we disconnect the device. Since grant map
operations change the mfn of the allocated page, and we can no longer
pass it to __free_page without setting the mfn to a sane value, use
balloon grant pages instead, as the gntdev device does.

Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
Cc: stable@vger.kernel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent f84adf49
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@
#include <xen/xen.h>
#include <xen/xen.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypercall.h>
#include <xen/balloon.h>
#include "common.h"
#include "common.h"


/*
/*
@@ -239,6 +240,7 @@ static void free_persistent_gnts(struct rb_root *root, unsigned int num)
			ret = gnttab_unmap_refs(unmap, NULL, pages,
			ret = gnttab_unmap_refs(unmap, NULL, pages,
				segs_to_unmap);
				segs_to_unmap);
			BUG_ON(ret);
			BUG_ON(ret);
			free_xenballooned_pages(segs_to_unmap, pages);
			segs_to_unmap = 0;
			segs_to_unmap = 0;
		}
		}


@@ -527,8 +529,8 @@ static int xen_blkbk_map(struct blkif_request *req,
				GFP_KERNEL);
				GFP_KERNEL);
			if (!persistent_gnt)
			if (!persistent_gnt)
				return -ENOMEM;
				return -ENOMEM;
			persistent_gnt->page = alloc_page(GFP_KERNEL);
			if (alloc_xenballooned_pages(1, &persistent_gnt->page,
			if (!persistent_gnt->page) {
			    false)) {
				kfree(persistent_gnt);
				kfree(persistent_gnt);
				return -ENOMEM;
				return -ENOMEM;
			}
			}