Can you please try this patch?
linux/blktap: fix vma_close() for partial munmap.
the previous vma_close() didn't take partial
munmap into acount. This patch fixes it.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
diff --git a/drivers/xen/blktap/blktap.c b/drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c
+++ b/drivers/xen/blktap/blktap.c
@@ -295,6 +295,7 @@ static inline int OFFSET_TO_SEG(int offs
*/
struct tap_vma_priv {
tap_blkif_t *info;
+ struct kref kref;
struct page *map[];
};
@@ -392,19 +393,31 @@ static pte_t blktap_clear_pte(struct vm_
return copy;
}
+static void blktap_vma_open(struct vm_area_struct *vma)
+{
+ struct tap_vma_priv *priv = vma->vm_private_data;
+ kref_get(&priv->kref);
+}
+
+
+static void blktap_vma_release(struct kref *kref)
+{
+ struct tap_vma_priv *priv = container_of(kref,
+ struct tap_vma_priv, kref);
+ priv->info->vma = NULL;
+ kfree(priv);
+}
+
static void blktap_vma_close(struct vm_area_struct *vma)
{
struct tap_vma_priv *priv = vma->vm_private_data;
-
- if (priv) {
- priv->info->vma = NULL;
- kfree(priv);
- }
+ kref_put(&priv->kref, blktap_vma_release);
}
struct vm_operations_struct blktap_vm_ops = {
nopage: blktap_nopage,
zap_pte: blktap_clear_pte,
+ open: blktap_vma_open,
close: blktap_vma_close,
};
@@ -707,6 +720,7 @@ static int blktap_mmap(struct file *filp
goto fail;
}
priv->info = info;
+ kref_init(&priv->kref);
vma->vm_private_data = priv;
vma->vm_flags |= VM_FOREIGN;
On Fri, Apr 24, 2009 at 05:27:43PM +0900, KUWAMURA Shin'ya wrote:
> Hi,
>
> I report a benchmark result of this week on IPF using
> ia64/xen-unstable and ia64/linux-2.6.18-xen.
>
> - The following cset broke tap:aio.
> 863: blktap: don't access deallocated data
> http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/464a925d73f1
> Guests hung up while booting, so we used file instead of tap:aio.
>
> - The issue that HVM domains cannot read the contents of HDD is fixed.
>
> TEST ENVIRONMENT
> Machine : Tiger4
> Kernel : 2.6.18.8-xen
> Changeset : 19562:5599cc1e0a84 (ia64/xen-unstable)
> 863:464a925d73f1 (ia64/linux-2.6.18-xen)
> 136:eb97cb2936d6 (efi-vfirmware)
> 08251d3 (qemu-xen-unstable)
> Dom0 OS : RHEL4 U2 (2P)
> DomU OS : RHEL4 U2 (8P, using tap:aio)
> DomVTi OS : RHEL4 U2 (8P, with PV-on-HVM drivers)
> CONFIG_QEMU : ioemu-remote
>
> TEST RESULTS
> DomU: # file
> unixbench4.1.0 : Pass
> bonnie++-1.03 : Pass
> ltp-full-20070930 : Pass
> iozone3_191 : Pass
> lmbench-3.0-a5 : Pass
> DomVTi: # file
> unixbench4.1.0 : Pass
> bonnie++-1.03 : Pass
> ltp-full-20070930 : Pass
> iozone3_191 : Pass
> lmbench-3.0-a5 : Pass
>
> Best regards,
> KUWAMURA Shin'ya and FUJITSU members
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>
--
yamahata
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|