diff --git a/block/nbd-client.c b/block/nbd-client.c index 5168a2cab6..ac93c4c0d0 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -189,9 +189,10 @@ static int nbd_co_receive_reply(NBDClientSession *s, s->requests[i].receiving = true; qemu_coroutine_yield(); s->requests[i].receiving = false; - if (s->reply.handle != request->handle || !s->ioc || s->quit) { + if (!s->ioc || s->quit) { ret = -EIO; } else { + assert(s->reply.handle == request->handle); ret = -s->reply.error; if (qiov && s->reply.error == 0) { assert(request->len == iov_size(qiov->iov, qiov->niov));