xen_disk: fix unmapping of persistent grants
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 13 Nov 2014 17:42:09 +0000 (18:42 +0100)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 14 Nov 2014 11:12:38 +0000 (11:12 +0000)
commit2f01dfacb56bc7a0d4639adc9dff9aae131e6216
tree8eb0745c9abb64db2873d8874816cbb890fb683f
parent91ab2ed7221c70ed7fd09ab2665b1f0493c775a4
xen_disk: fix unmapping of persistent grants

This patch fixes two issues with persistent grants and the disk PV backend
(Qdisk):

 - Keep track of memory regions where persistent grants have been mapped
   since we need to unmap them as a whole. It is not possible to unmap a
   single grant if it has been batch-mapped. A new check has also been added
   to make sure persistent grants are only used if the whole mapped region
   can be persistently mapped in the batch_maps case.
 - Unmap persistent grants before switching to the closed state, so the
   frontend can also free them.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported-by: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
hw/block/xen_disk.c