]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen-blkback: use balloon pages for persistent grants
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 14 Feb 2013 10:12:09 +0000 (11:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2013 22:03:35 +0000 (06:03 +0800)
commit 087ffecdaa1875cc683a7a5bc0695b3ebfce3bad upstream.

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: Roger Pau Monné <roger.pau@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/xen-blkback/blkback.c

index 1966a7cfd8ce9d5a4f582aa3656f87378f22f70c..de1f319f7bd7e0118a960b5bd23fd286a6ba343e 100644 (file)
@@ -46,6 +46,7 @@
 #include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/hypercall.h>
+#include <xen/balloon.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,
                                segs_to_unmap);
                        BUG_ON(ret);
+                       free_xenballooned_pages(segs_to_unmap, pages);
                        segs_to_unmap = 0;
                }
 
@@ -527,8 +529,8 @@ static int xen_blkbk_map(struct blkif_request *req,
                                GFP_KERNEL);
                        if (!persistent_gnt)
                                return -ENOMEM;
-                       persistent_gnt->page = alloc_page(GFP_KERNEL);
-                       if (!persistent_gnt->page) {
+                       if (alloc_xenballooned_pages(1, &persistent_gnt->page,
+                           false)) {
                                kfree(persistent_gnt);
                                return -ENOMEM;
                        }