qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Coiby Xu <coiby.xu@gmail.com>,
	mreitz@redhat.com, Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 10/11] block/export: report flush errors
Date: Tue, 22 Sep 2020 17:04:00 +0100	[thread overview]
Message-ID: <20200922160401.294055-11-stefanha@redhat.com> (raw)
In-Reply-To: <20200922160401.294055-1-stefanha@redhat.com>

Propagate the flush return value since errors are possible.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/export/vhost-user-blk-server.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user-blk-server.c
index b609a3e4d6..44d3c45fa2 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),
-- 
2.26.2


  parent reply	other threads:[~2020-09-22 16:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 16:03 [PATCH 00/11] block/export: convert vhost-user-blk-server to block exports API Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 01/11] block/export: shorten serial string to fit Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 02/11] util/vhost-user-server: s/fileds/fields/ typo fix Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 03/11] util/vhost-user-server: drop unnecessary QOM cast Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 04/11] util/vhost-user-server: drop unnecessary watch deletion Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 05/11] block/export: consolidate request structs into VuBlockReq Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 06/11] util/vhost-user-server: drop unused DevicePanicNotifier Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 07/11] util/vhost-user-server: fix memory leak in vu_message_read() Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 08/11] util/vhost-user-server: check EOF when reading payload Stefan Hajnoczi
2020-09-22 16:03 ` [PATCH 09/11] util/vhost-user-server: rework vu_client_trip() coroutine lifecycle Stefan Hajnoczi
2020-09-22 16:04 ` Stefan Hajnoczi [this message]
2020-09-22 16:04 ` [PATCH 11/11] block/export: convert vhost-user-blk server to block export API Stefan Hajnoczi
2020-09-23 13:42   ` Markus Armbruster
2020-09-23 18:29     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922160401.294055-11-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=coiby.xu@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).