]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/mini-os.git/commitdiff
minios: Fix bug when blkfront reading into zero-mapped buffer
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 29 Jan 2008 15:18:27 +0000 (15:18 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 29 Jan 2008 15:18:27 +0000 (15:18 +0000)
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>
blkfront.c

index 7fff105635f1839f503654006b9cf6241642002f..0c77d6d1e4c8badd762889fca152c40bab318309 100644 (file)
@@ -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;