diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-09-07 17:53:59 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-09-07 17:53:59 +0100 |
commit | 75be9a52b147790decd62e43d279a5f3dfc95b5c (patch) | |
tree | 066cf2dbca492a4d64fbc04169777a1486a13429 /block | |
parent | ef475b5dd12684591e6264e517eaa5b3e90f7ffa (diff) | |
parent | 030fa7f6f950f5c8963f1dee8e6bb7387ed86a99 (diff) |
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-09-06' into staging
nbd patches for 2017-09-06
- Daniel P. Berrange: [0/2] Fix / skip recent iotests with LUKS driver
- Eric Blake: [0/3] nbd: Use common read/write-all qio functions
# gpg: Signature made Wed 06 Sep 2017 16:17:55 BST
# gpg: using RSA key 0xA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg: aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A
* remotes/ericb/tags/pull-nbd-2017-09-06:
nbd: Use new qio_channel_*_all() functions
io: Add new qio_channel_read{, v}_all_eof functions
io: Yield rather than wait when already in coroutine
iotests: blacklist 194 with the luks driver
iotests: rewrite 192 to use _launch_qemu to fix LUKS support
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/nbd-client.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/block/nbd-client.c b/block/nbd-client.c index f0dbea24d3..ee7f758e68 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -121,7 +121,7 @@ static int nbd_co_send_request(BlockDriverState *bs, QEMUIOVector *qiov) { NBDClientSession *s = nbd_get_client_session(bs); - int rc, ret, i; + int rc, i; qemu_co_mutex_lock(&s->send_mutex); while (s->in_flight == MAX_NBD_REQUESTS) { @@ -156,9 +156,9 @@ static int nbd_co_send_request(BlockDriverState *bs, qio_channel_set_cork(s->ioc, true); rc = nbd_send_request(s->ioc, request); if (rc >= 0 && !s->quit) { - ret = nbd_rwv(s->ioc, qiov->iov, qiov->niov, request->len, false, - NULL); - if (ret != request->len) { + assert(request->len == iov_size(qiov->iov, qiov->niov)); + if (qio_channel_writev_all(s->ioc, qiov->iov, qiov->niov, + NULL) < 0) { rc = -EIO; } } @@ -184,7 +184,6 @@ static void nbd_co_receive_reply(NBDClientSession *s, QEMUIOVector *qiov) { int i = HANDLE_TO_INDEX(s, request->handle); - int ret; /* Wait until we're woken up by nbd_read_reply_entry. */ s->requests[i].receiving = true; @@ -195,9 +194,9 @@ static void nbd_co_receive_reply(NBDClientSession *s, reply->error = EIO; } else { if (qiov && reply->error == 0) { - ret = nbd_rwv(s->ioc, qiov->iov, qiov->niov, request->len, true, - NULL); - if (ret != request->len) { + assert(request->len == iov_size(qiov->iov, qiov->niov)); + if (qio_channel_readv_all(s->ioc, qiov->iov, qiov->niov, + NULL) < 0) { reply->error = EIO; s->quit = true; } |