]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen/blkback: Fix the inhibition to map pages when discarding sector ranges.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 10 Oct 2011 04:47:49 +0000 (00:47 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 11 Oct 2011 19:02:55 +0000 (15:02 -0400)
The 'operation' parameters are the ones provided to the bio layer while
the req->operation are the ones passed in between the backend and
frontend. We used the wrong 'operation' value to squash the
call to map pages when processing the discard operation resulting
in an hypercall that did nothing. Lets guard against going in the
mapping function by checking for the amount of segments.

CC: Li Dongyang <lidongyang@novell.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkback/blkback.c

index c15c559e8662a7a7f34cbd999c58e9465f4efefe..94e659d2586e7f20625c849e5fcaaaa75298e847 100644 (file)
@@ -707,8 +707,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
         * the hypercall to unmap the grants - that is all done in
         * xen_blkbk_unmap.
         */
-       if (operation != BLKIF_OP_DISCARD &&
-                       xen_blkbk_map(req, pending_req, seg))
+       if (nseg && xen_blkbk_map(req, pending_req, seg))
                goto fail_flush;
 
        /*