summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2018-03-12 18:21:22 +0300
committerEric Blake <eblake@redhat.com>2018-03-13 15:38:56 -0500
commit1e98efc0299977a4b0815c2d0a216ae19881e389 (patch)
treef2239e787ae94cf616effa91f06ef8aca77fa7cf /block
parente7b1948d510d2e8805db8efaf704bd82d3966963 (diff)
downloadqemu-1e98efc0299977a4b0815c2d0a216ae19881e389.zip
block/nbd-client: save first fatal error in nbd_iter_error
It is ok, that fatal error hides previous not fatal, but hiding first fatal error is a bad feature. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180312152126.286890-5-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/nbd-client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c
index 7b68499b76..0d9f73a137 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -481,6 +481,7 @@ static coroutine_fn int nbd_co_receive_one_chunk(
typedef struct NBDReplyChunkIter {
int ret;
+ bool fatal;
Error *err;
bool done, only_structured;
} NBDReplyChunkIter;
@@ -490,11 +491,12 @@ static void nbd_iter_error(NBDReplyChunkIter *iter, bool fatal,
{
assert(ret < 0);
- if (fatal || iter->ret == 0) {
+ if ((fatal && !iter->fatal) || iter->ret == 0) {
if (iter->ret != 0) {
error_free(iter->err);
iter->err = NULL;
}
+ iter->fatal = fatal;
iter->ret = ret;
error_propagate(&iter->err, *local_err);
} else {