[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/11] sheepdog: check return values of qemu_co_recv
From: |
MORITA Kazutaka |
Subject: |
[Qemu-devel] [PATCH 05/11] sheepdog: check return values of qemu_co_recv/send correctly |
Date: |
Tue, 23 Jul 2013 17:30:15 +0900 |
qemu_co_recv/send return shorter length on error.
Signed-off-by: MORITA Kazutaka <address@hidden>
---
block/sheepdog.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 6f5ede4..567f52e 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -727,7 +727,7 @@ static void coroutine_fn aio_read_response(void *opaque)
/* read a header */
ret = qemu_co_recv(fd, &rsp, sizeof(rsp));
- if (ret < 0) {
+ if (ret < sizeof(rsp)) {
error_report("failed to get the header, %s", strerror(errno));
goto out;
}
@@ -778,7 +778,7 @@ static void coroutine_fn aio_read_response(void *opaque)
case AIOCB_READ_UDATA:
ret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov,
aio_req->iov_offset, rsp.data_length);
- if (ret < 0) {
+ if (ret < rsp.data_length) {
error_report("failed to get the data, %s", strerror(errno));
goto out;
}
@@ -1131,7 +1131,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState
*s, AIOReq *aio_req,
/* send a header */
ret = qemu_co_send(s->fd, &hdr, sizeof(hdr));
- if (ret < 0) {
+ if (ret < sizeof(hdr)) {
qemu_co_mutex_unlock(&s->lock);
error_report("failed to send a req, %s", strerror(errno));
return -errno;
@@ -1139,7 +1139,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState
*s, AIOReq *aio_req,
if (wlen) {
ret = qemu_co_sendv(s->fd, iov, niov, aio_req->iov_offset, wlen);
- if (ret < 0) {
+ if (ret < wlen) {
qemu_co_mutex_unlock(&s->lock);
error_report("failed to send a data, %s", strerror(errno));
return -errno;
--
1.8.1.3.566.gaa39828
- [Qemu-devel] [PATCH 03/11] qemu-sockets: make wait_for_connect be invoked in qemu_aio_wait, (continued)
- [Qemu-devel] [PATCH 03/11] qemu-sockets: make wait_for_connect be invoked in qemu_aio_wait, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 02/11] iov: handle EOF in iov_send_recv, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 01/11] ignore SIGPIPE in qemu-img and qemu-io, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 09/11] sheepdog: try to reconnect to sheepdog after network error, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 07/11] sheepdog: reload inode outside of resend_aioreq, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 11/11] sheepdog: cancel aio requests if possible, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 08/11] coroutine: add co_aio_sleep_ns() to allow sleep in block drivers, MORITA Kazutaka, 2013/07/23
- [Qemu-devel] [PATCH 05/11] sheepdog: check return values of qemu_co_recv/send correctly,
MORITA Kazutaka <=
- [Qemu-devel] [PATCH 10/11] sheepdog: make add_aio_request and send_aioreq void functions, MORITA Kazutaka, 2013/07/23