Skip to content

Commit

Permalink
block/nbd-client: save first fatal error in nbd_iter_error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and ebblake committed Mar 13, 2018
1 parent e7b1948 commit 1e98efc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/nbd-client.c
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit 1e98efc

Please sign in to comment.