From patchwork Mon Jan 30 17:10:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MORITA Kazutaka X-Patchwork-Id: 138719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7F72A1007D2 for ; Tue, 31 Jan 2012 19:54:32 +1100 (EST) Received: from localhost ([::1]:38968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rs9Gf-0002DL-MJ for incoming@patchwork.ozlabs.org; Tue, 31 Jan 2012 03:40:45 -0500 Received: from eggs.gnu.org ([140.186.70.92]:39384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rruam-0007H2-Vn for qemu-devel@nongnu.org; Mon, 30 Jan 2012 12:00:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rruae-00049R-Fu for qemu-devel@nongnu.org; Mon, 30 Jan 2012 12:00:32 -0500 Received: from sh.osrg.net ([192.16.179.4]:49434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rruad-00047o-6H for qemu-devel@nongnu.org; Mon, 30 Jan 2012 12:00:23 -0500 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id q0UGxvJt005866; Tue, 31 Jan 2012 01:59:57 +0900 Received: from localhost (dfs1401.osrg.net [10.68.14.1]) by fs.osrg.net (Postfix) with ESMTP id C34DD3E0221; Tue, 31 Jan 2012 01:59:57 +0900 (JST) From: MORITA Kazutaka To: kwolf@redhat.com Date: Tue, 31 Jan 2012 02:10:06 +0900 Message-Id: <1327943406-26444-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Mailer: git-send-email 1.7.2.5 X-Dispatcher: imput version 20100215(IM150) Lines: 33 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.7 (sh.osrg.net [192.16.179.4]); Tue, 31 Jan 2012 01:59:59 +0900 (JST) X-Virus-Scanned: clamav-milter 0.97.3 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 192.16.179.4 X-Mailman-Approved-At: Tue, 31 Jan 2012 03:40:37 -0500 Cc: stefanha@gmail.com, sheepdog@lists.wpkg.org, hch@lst.de, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] sheepdog: fix co_recv coroutine context 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 The co_recv coroutine has two things that will try to enter it: 1. The select(2) read callback on the sheepdog socket. 2. The aio_add_request() blocking operations, including a coroutine mutex. This patch fixes it by setting NULL to co_recv before sending data. In future, we should make the sheepdog driver fully coroutine-based and simplify request handling. Signed-off-by: MORITA Kazutaka --- block/sheepdog.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 9416400..00276f6f 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -629,6 +629,9 @@ static void coroutine_fn aio_read_response(void *opaque) switch (acb->aiocb_type) { case AIOCB_WRITE_UDATA: + /* this coroutine context is no longer suitable for co_recv + * because we may send data to update vdi objects */ + s->co_recv = NULL; if (!is_data_obj(aio_req->oid)) { break; }