From patchwork Thu Jul 25 05:25:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yuan X-Patchwork-Id: 261589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1CD422C009A for ; Thu, 25 Jul 2013 15:26:32 +1000 (EST) Received: from localhost ([::1]:54937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2E4L-0001xO-Uq for incoming@patchwork.ozlabs.org; Thu, 25 Jul 2013 01:26:29 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=4nAB1092NGzktUr9YUt4HZ0ESQaelq1jidDqB2dK8mQ=; b=Sbc/puY9nVPg8TolPNR8qHbg7soZX8HD3j5rEZIPyIOBsMNrHxSFpBR+XT8OCGESd2 OK2AoQZLpzIXHGZho0GX+d2a3txY7bHAw/Re3P9mzT3FIKz846Gn/cr3RBcpPD8e0aT8 0YIE5X+QCNuAgsucPPe/2Kytf7HEqacr/r42NrmKd4TMlYThhOojqL6HS0JrRj50JXla +FnD2Bgx6td7aJlvt6eY+t7sC2upbD0jadGgBcKu5dFGsGe0f/XT5dsiR39/ca6OHTws MSEHYHanBTmdVlatmWo0Hd1iHkw+h4ndD/k+0tFAVHr53S6ar+85Mir9XnzORSszLZtd PGAg== X-Received: by 10.68.204.194 with SMTP id la2mr46316253pbc.71.1374729960917; Wed, 24 Jul 2013 22:26:00 -0700 (PDT) Received: from ubuntu-precise.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPSA id sz6sm55385245pab.5.2013.07.24.22.25.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Jul 2013 22:25:59 -0700 (PDT) From: Liu Yuan To: sheepdog@lists.wpkg.org, morita.kazutaka@lab.ntt.co.jp Date: Thu, 25 Jul 2013 13:25:35 +0800 Message-Id: <1374729935-27667-3-git-send-email-namei.unix@gmail.com> X-Mailer: git-send-email 1.7.9.5 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> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::235 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: