WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix error path in blkback driver where a grant mapping i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix error path in blkback driver where a grant mapping in the
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 06 Nov 2005 19:56:07 +0000
Delivery-date: Sun, 06 Nov 2005 23:12:41 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 55194bd55b86383fa82797f99f95587f6d14fa30
# Parent  c352591ebfdfbaa1d1132268455b9b13829af0a2
Fix error path in blkback driver where a grant mapping in the
middle of a batch fails. Spotted by Harry Butterworth (IBM).

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r c352591ebfdf -r 55194bd55b86 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sun Nov  6 
15:40:33 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sun Nov  6 
16:50:24 2005
@@ -340,7 +340,7 @@
        struct bio *bio = NULL, *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST];
        int nbio = 0;
        request_queue_t *q;
-       int ret;
+       int ret, errors = 0;
 
        /* Check that number of segments is sane. */
        nseg = req->nr_segments;
@@ -374,23 +374,23 @@
        BUG_ON(ret);
 
        for (i = 0; i < nseg; i++) {
-               if (unlikely(map[i].handle < 0)) {
-                       DPRINTK("invalid buffer -- could not remap it\n");
-                       fast_flush_area(pending_idx, nseg);
-                       goto bad_descriptor;
+               if (likely(map[i].handle >= 0)) {
+                       pending_handle(pending_idx, i) = map[i].handle;
+                       phys_to_machine_mapping[__pa(MMAP_VADDR(
+                               pending_idx, i)) >> PAGE_SHIFT] =
+                               FOREIGN_FRAME(map[i].dev_bus_addr>>PAGE_SHIFT);
+                       fas        = req->frame_and_sects[i];
+                       seg[i].buf = map[i].dev_bus_addr | 
+                               (blkif_first_sect(fas) << 9);
+               } else {
+                       errors++;
                }
-
-               phys_to_machine_mapping[__pa(MMAP_VADDR(
-                       pending_idx, i)) >> PAGE_SHIFT] =
-                       FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
-
-               pending_handle(pending_idx, i) = map[i].handle;
-       }
-
-       for (i = 0; i < nseg; i++) {
-               fas         = req->frame_and_sects[i];
-               seg[i].buf  = map[i].dev_bus_addr | 
-                       (blkif_first_sect(fas) << 9);
+       }
+
+       if (errors) {
+               DPRINTK("invalid buffer -- could not remap it\n");
+               fast_flush_area(pending_idx, nseg);
+               goto bad_descriptor;
        }
 
        if (vbd_translate(&preq, blkif, operation) != 0) {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix error path in blkback driver where a grant mapping in the, Xen patchbot -unstable <=