From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2E3u-0001qs-LK for qemu-devel@nongnu.org; Thu, 25 Jul 2013 01:26:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2E3t-0002o6-QU for qemu-devel@nongnu.org; Thu, 25 Jul 2013 01:26:02 -0400 Received: from mail-pd0-x235.google.com ([2607:f8b0:400e:c02::235]:58828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2E3t-0002o1-K5 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 01:26:01 -0400 Received: by mail-pd0-f181.google.com with SMTP id g12so753665pdj.12 for ; Wed, 24 Jul 2013 22:26:00 -0700 (PDT) From: Liu Yuan Date: Thu, 25 Jul 2013 13:25:35 +0800 Message-Id: <1374729935-27667-3-git-send-email-namei.unix@gmail.com> In-Reply-To: <1374729935-27667-1-git-send-email-namei.unix@gmail.com> References: <20130725033651.GB24069@ubuntu-precise> <1374729935-27667-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH 2/2] sheepdog: put aio request into failed list when failing to send request List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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 --- 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