Revision f35d68f0

b/hw/virtio-blk.c
98 98
    qemu_free(req);
99 99
}
100 100

  
101
static int virtio_blk_handle_write_error(VirtIOBlockReq *req, int error)
101
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
102
    int is_read)
102 103
{
103
    BlockInterfaceErrorAction action = drive_get_on_error(req->dev->bs, 0);
104
    BlockInterfaceErrorAction action =
105
        drive_get_on_error(req->dev->bs, is_read);
104 106
    VirtIOBlock *s = req->dev;
105 107

  
106 108
    if (action == BLOCK_ERR_IGNORE)
......
122 124
{
123 125
    VirtIOBlockReq *req = opaque;
124 126

  
125
    if (ret && (req->out->type & VIRTIO_BLK_T_OUT)) {
126
        if (virtio_blk_handle_write_error(req, -ret))
127
    if (ret) {
128
        int is_read = !(req->out->type & VIRTIO_BLK_T_OUT);
129
        if (virtio_blk_handle_rw_error(req, -ret, is_read))
127 130
            return;
128 131
    }
129 132

  
130
    virtio_blk_req_complete(req, ret ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK);
133
    virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
131 134
}
132 135

  
133 136
static void virtio_blk_flush_complete(void *opaque, int ret)
b/vl.c
2198 2198

  
2199 2199
    on_read_error = BLOCK_ERR_REPORT;
2200 2200
    if ((buf = qemu_opt_get(opts, "rerror")) != NULL) {
2201
        if (type != IF_IDE) {
2201
        if (type != IF_IDE && type != IF_VIRTIO) {
2202 2202
            fprintf(stderr, "rerror is no supported by this format\n");
2203 2203
            return NULL;
2204 2204
        }

Also available in: Unified diff