diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2017-10-27 12:40:35 +0200 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2017-10-30 21:48:32 +0100 |
commit | d2febedb45729d1fe431ca7c1ed9519acfb454c4 (patch) | |
tree | 7448dd5b0ab5ae8fa857f7d9640515ff004ad56a /block/nbd-client.c | |
parent | d795299bf497a6155f6cecff83a5e41bb37aba2c (diff) |
nbd/client: prepare nbd_receive_reply for structured reply
In following patch nbd_receive_reply will be used both for simple
and structured reply header receiving.
NBDReply is altered into union of simple reply header and structured
reply chunk header, simple error translation moved to block/nbd-client
to be consistent with further structured reply error translation.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171027104037.8319-11-eblake@redhat.com>
Diffstat (limited to 'block/nbd-client.c')
-rw-r--r-- | block/nbd-client.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c index c0683c3c83..58493b7ac4 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -92,7 +92,9 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque) i = HANDLE_TO_INDEX(s, s->reply.handle); if (i >= MAX_NBD_REQUESTS || !s->requests[i].coroutine || - !s->requests[i].receiving) { + !s->requests[i].receiving || + nbd_reply_is_structured(&s->reply)) + { break; } @@ -194,8 +196,8 @@ static int nbd_co_receive_reply(NBDClientSession *s, ret = -EIO; } else { assert(s->reply.handle == handle); - ret = -s->reply.error; - if (qiov && s->reply.error == 0) { + ret = -nbd_errno_to_system_errno(s->reply.simple.error); + if (qiov && ret == 0) { if (qio_channel_readv_all(s->ioc, qiov->iov, qiov->niov, NULL) < 0) { ret = -EIO; |