aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/blkfront.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-01-29 15:18:27 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-01-29 15:18:27 +0000
commit7b1257946080b63421a8dc59c7b3dfd67997c643 (patch)
treee6bc5b081658357374b6126d0cb2625713889796 /extras/mini-os/blkfront.c
parent34d2cb5d8d8cbf8a469048ac6e7af831c105274b (diff)
downloadxen-7b1257946080b63421a8dc59c7b3dfd67997c643.tar.gz
xen-7b1257946080b63421a8dc59c7b3dfd67997c643.tar.bz2
xen-7b1257946080b63421a8dc59c7b3dfd67997c643.zip
minios: Fix bug when blkfront reading into zero-mapped buffer
by just poking the page. No need to use virtual_to_mfn() for the ring since that is a real page. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/blkfront.c')
-rw-r--r--extras/mini-os/blkfront.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/extras/mini-os/blkfront.c b/extras/mini-os/blkfront.c
index 7fff105635..0c77d6d1e4 100644
--- a/extras/mini-os/blkfront.c
+++ b/extras/mini-os/blkfront.c
@@ -88,7 +88,7 @@ struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *
SHARED_RING_INIT(s);
FRONT_RING_INIT(&dev->ring, s, PAGE_SIZE);
- dev->ring_ref = gnttab_grant_access(0,virtual_to_mfn(s),0);
+ dev->ring_ref = gnttab_grant_access(0,virt_to_mfn(s),0);
evtchn_alloc_unbound_t op;
op.dom = DOMID_SELF;
@@ -274,6 +274,11 @@ void blkfront_aio(struct blkfront_aiocb *aiocbp, int write)
for (j = 0; j < n; j++) {
uintptr_t data = start + j * PAGE_SIZE;
+ if (!write) {
+ /* Trigger CoW if needed */
+ *(char*)data = 0;
+ barrier();
+ }
aiocbp->gref[j] = req->seg[j].gref =
gnttab_grant_access(0, virtual_to_mfn(data), write);
req->seg[j].first_sect = 0;