From: Liu Yuan <namei.unix@gmail.com>
To: sheepdog@lists.wpkg.org, morita.kazutaka@lab.ntt.co.jp
Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] sheepdog: put aio request into failed list when failing to send request
Date: Thu, 25 Jul 2013 13:25:35 +0800 [thread overview]
Message-ID: <1374729935-27667-3-git-send-email-namei.unix@gmail.com> (raw)
In-Reply-To: <1374729935-27667-1-git-send-email-namei.unix@gmail.com>
qemu_co_send() in the add_aio_request might fail if connection is closed. In
this case we should it requests into failed list to be resended later when
connection is repaired.
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
---
block/sheepdog.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 8c6c8f1..5bf78d0 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1174,14 +1174,18 @@ static void coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
/* send a header */
ret = qemu_co_send(s->fd, &hdr, sizeof(hdr));
if (ret < (int)sizeof(hdr)) {
- error_report("failed to send a req, %s", strerror(errno));
+ dprintf("failed to send a req, %s", strerror(errno));
+ QLIST_REMOVE(aio_req, aio_siblings);
+ QLIST_INSERT_HEAD(&s->pending_aio_head, aio_req, aio_siblings);
goto out;
}
if (wlen) {
ret = qemu_co_sendv(s->fd, iov, niov, aio_req->iov_offset, wlen);
if (ret < wlen) {
- error_report("failed to send a data, %s", strerror(errno));
+ dprintf("failed to send a data, %s", strerror(errno));
+ QLIST_REMOVE(aio_req, aio_siblings);
+ QLIST_INSERT_HEAD(&s->pending_aio_head, aio_req, aio_siblings);
}
}
out:
--
1.7.9.5
next prev parent reply other threads:[~2013-07-25 5:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 7:56 [Qemu-devel] [PATCH v2 0/9] sheepdog: reconnect server after connection failure MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 1/9] ignore SIGPIPE in qemu-img and qemu-io MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 2/9] iov: handle EOF in iov_send_recv MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 3/9] sheepdog: check return values of qemu_co_recv/send correctly MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 4/9] sheepdog: handle vdi objects in resend_aio_req MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 5/9] sheepdog: reload inode outside of resend_aioreq MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 6/9] coroutine: add co_aio_sleep_ns() to allow sleep in block drivers MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 7/9] sheepdog: try to reconnect to sheepdog after network error MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 8/9] sheepdog: make add_aio_request and send_aioreq void functions MORITA Kazutaka
2013-07-24 7:56 ` [Qemu-devel] [PATCH v2 9/9] sheepdog: cancel aio requests if possible MORITA Kazutaka
2013-07-24 8:28 ` [Qemu-devel] [sheepdog] [PATCH v2 0/9] sheepdog: reconnect server after connection failure Liu Yuan
2013-07-24 9:07 ` MORITA Kazutaka
2013-07-24 15:42 ` Liu Yuan
2013-07-25 3:36 ` Liu Yuan
2013-07-25 5:25 ` [Qemu-devel] " Liu Yuan
2013-07-25 5:25 ` [Qemu-devel] [PATCH 1/2] sheepdog: correct signedness of comparison Liu Yuan
2013-07-25 5:25 ` Liu Yuan [this message]
2013-07-25 5:53 ` [Qemu-devel] [sheepdog] [PATCH v2 0/9] sheepdog: reconnect server after connection failure MORITA Kazutaka
2013-07-25 6:02 ` Liu Yuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374729935-27667-3-git-send-email-namei.unix@gmail.com \
--to=namei.unix@gmail.com \
--cc=kwolf@redhat.com \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sheepdog@lists.wpkg.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).