提交 908c7b9f 编写于 作者: G Gerd Hoffmann 提交者: Blue Swirl

xen_disk: move sanity check to the correct place

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 70503264
......@@ -179,10 +179,6 @@ static int ioreq_parse(struct ioreq *ioreq)
switch (ioreq->req.operation) {
case BLKIF_OP_READ:
ioreq->prot = PROT_WRITE; /* to memory */
if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
goto err;
}
break;
case BLKIF_OP_WRITE_BARRIER:
if (!syncwrite)
......@@ -199,6 +195,11 @@ static int ioreq_parse(struct ioreq *ioreq)
goto err;
};
if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
goto err;
}
ioreq->start = ioreq->req.sector_number * blkdev->file_blk;
for (i = 0; i < ioreq->req.nr_segments; i++) {
if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册