summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorStefan Hajnoczi2020-09-24 17:15:46 +0200
committerStefan Hajnoczi2020-10-23 14:42:16 +0200
commit0534b1b227ef85c59d65b5ec5bee9bcfb8f91b1f (patch)
tree4f4d060cf8abf269202b7f18af809c1e16fb4ffa /block
parentutil/vhost-user-server: rework vu_client_trip() coroutine lifecycle (diff)
downloadqemu-0534b1b227ef85c59d65b5ec5bee9bcfb8f91b1f.tar.gz
qemu-0534b1b227ef85c59d65b5ec5bee9bcfb8f91b1f.tar.xz
qemu-0534b1b227ef85c59d65b5ec5bee9bcfb8f91b1f.zip
block/export: report flush errors
Propagate the flush return value since errors are possible. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-11-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/export/vhost-user-blk-server.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
index 4d35232bf3..faefcfcaea 100644
--- a/block/export/vhost-user-blk-server.c
+++ b/block/export/vhost-user-blk-server.c
@@ -78,11 +78,11 @@ vu_block_discard_write_zeroes(VuBlockReq *req, struct iovec *iov,
return -EINVAL;
}
-static void coroutine_fn vu_block_flush(VuBlockReq *req)
+static int coroutine_fn vu_block_flush(VuBlockReq *req)
{
VuBlockDev *vdev_blk = get_vu_block_device_by_server(req->server);
BlockBackend *backend = vdev_blk->backend;
- blk_co_flush(backend);
+ return blk_co_flush(backend);
}
static void coroutine_fn vu_block_virtio_process_req(void *opaque)
@@ -152,8 +152,11 @@ static void coroutine_fn vu_block_virtio_process_req(void *opaque)
break;
}
case VIRTIO_BLK_T_FLUSH:
- vu_block_flush(req);
- req->in->status = VIRTIO_BLK_S_OK;
+ if (vu_block_flush(req) == 0) {
+ req->in->status = VIRTIO_BLK_S_OK;
+ } else {
+ req->in->status = VIRTIO_BLK_S_IOERR;
+ }
break;
case VIRTIO_BLK_T_GET_ID: {
size_t size = MIN(iov_size(&elem->in_sg[0], in_num),