From patchwork Mon Mar 11 09:01:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MORITA Kazutaka X-Patchwork-Id: 226503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8DBE92C008D for ; Mon, 11 Mar 2013 20:20:05 +1100 (EST) Received: from localhost ([::1]:35804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEytn-0001hB-Oh for incoming@patchwork.ozlabs.org; Mon, 11 Mar 2013 05:20:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEytX-0001gl-Eo for qemu-devel@nongnu.org; Mon, 11 Mar 2013 05:19:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEytV-0001BP-BG for qemu-devel@nongnu.org; Mon, 11 Mar 2013 05:19:47 -0400 Received: from sh.osrg.net ([192.16.179.4]:58416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEycY-0004AB-EM for qemu-devel@nongnu.org; Mon, 11 Mar 2013 05:02:14 -0400 Received: from fs.osrg.net (localns.osrg.net [10.0.0.11]) by sh.osrg.net (8.14.4/8.14.4/OSRG-NET) with ESMTP id r2B926NL029251; Mon, 11 Mar 2013 18:02:07 +0900 Received: from localhost (unknown [10.32.32.72]) by fs.osrg.net (Postfix) with ESMTP id AEFE7F941; Mon, 11 Mar 2013 18:02:06 +0900 (JST) From: MORITA Kazutaka To: kwolf@redhat.com, stefanha@redhat.com Date: Mon, 11 Mar 2013 18:01:02 +0900 Message-Id: <1362992462-1864-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Mailer: git-send-email 1.8.1.3.566.gaa39828 X-Dispatcher: imput version 20100215(IM150) Lines: 46 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (sh.osrg.net [192.16.179.4]); Mon, 11 Mar 2013 18:02:07 +0900 (JST) X-Virus-Scanned: clamav-milter 0.97.6 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 192.16.179.4 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] sheepdog: set io_flush handler in do_co_req 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 If an io_flush handler is not set, qemu_aio_wait doesn't invoke callbacks. Signed-off-by: MORITA Kazutaka --- block/sheepdog.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index e4ec32d..cb0eeed 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -501,6 +501,13 @@ static void restart_co_req(void *opaque) qemu_coroutine_enter(co, NULL); } +static int have_co_req(void *opaque) +{ + /* this handler is set only when there is a pending request, so + * always returns 1. */ + return 1; +} + typedef struct SheepdogReqCo { int sockfd; SheepdogReq *hdr; @@ -523,14 +530,14 @@ static coroutine_fn void do_co_req(void *opaque) unsigned int *rlen = srco->rlen; co = qemu_coroutine_self(); - qemu_aio_set_fd_handler(sockfd, NULL, restart_co_req, NULL, co); + qemu_aio_set_fd_handler(sockfd, NULL, restart_co_req, have_co_req, co); ret = send_co_req(sockfd, hdr, data, wlen); if (ret < 0) { goto out; } - qemu_aio_set_fd_handler(sockfd, restart_co_req, NULL, NULL, co); + qemu_aio_set_fd_handler(sockfd, restart_co_req, NULL, have_co_req, co); ret = qemu_co_recv(sockfd, hdr, sizeof(*hdr)); if (ret < sizeof(*hdr)) {