Commit 908c7b9f788b6faed2fbfdf19920770614f8e853
Committed by
Blue Swirl
1 parent
70503264
xen_disk: move sanity check to the correct place
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Showing
1 changed file
with
5 additions
and
4 deletions
hw/xen_disk.c
| ... | ... | @@ -179,10 +179,6 @@ static int ioreq_parse(struct ioreq *ioreq) |
| 179 | 179 | switch (ioreq->req.operation) { |
| 180 | 180 | case BLKIF_OP_READ: |
| 181 | 181 | ioreq->prot = PROT_WRITE; /* to memory */ |
| 182 | - if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { | |
| 183 | - xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); | |
| 184 | - goto err; | |
| 185 | - } | |
| 186 | 182 | break; |
| 187 | 183 | case BLKIF_OP_WRITE_BARRIER: |
| 188 | 184 | if (!syncwrite) |
| ... | ... | @@ -199,6 +195,11 @@ static int ioreq_parse(struct ioreq *ioreq) |
| 199 | 195 | goto err; |
| 200 | 196 | }; |
| 201 | 197 | |
| 198 | + if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { | |
| 199 | + xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); | |
| 200 | + goto err; | |
| 201 | + } | |
| 202 | + | |
| 202 | 203 | ioreq->start = ioreq->req.sector_number * blkdev->file_blk; |
| 203 | 204 | for (i = 0; i < ioreq->req.nr_segments; i++) { |
| 204 | 205 | if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) { | ... | ... |