From nobody Sun Oct 26 00:02:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151627991388313.561223209461787; Thu, 18 Jan 2018 04:51:53 -0800 (PST) Received: from localhost ([::1]:56953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ec9fc-0007qB-SS for importer@patchew.org; Thu, 18 Jan 2018 07:51:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ec9Xz-0001Dm-Ho for qemu-devel@nongnu.org; Thu, 18 Jan 2018 07:44:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ec9Xy-0004Wp-5d for qemu-devel@nongnu.org; Thu, 18 Jan 2018 07:43:59 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ec9Xx-0004WZ-UJ; Thu, 18 Jan 2018 07:43:58 -0500 Received: by mail-wr0-x244.google.com with SMTP id g38so19205844wrd.2; Thu, 18 Jan 2018 04:43:57 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id t51sm13006472wrc.21.2018.01.18.04.43.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 04:43:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y1L8IHI11QecjqL/YZfNecRZyKoC5SoS8DJg/mA4eV0=; b=BU4xxICBPl3N1eLpLmvZoE6UXlFXAVMeu2L17h2cHw+sYVf9WfjrL7f/5nTZrmHJzw 50A0OQzCJgCOZ6hvM51YcutXt9pOMt7oqTJ5r/Z7unWqYhGfGbvB/YYTCb50PhodB8FU bBR47yMn3wPRg2pWbnmdqHwid3FklHhvjdBGu0cr0o49N1wLuWDEewLOtHpu0uYjTPtq 0l8yxM4cOrbukYLA5Poyx6kPViSIme8xsR4ZLGBoP+Old4ozYeDVZ/pT/a8n77jdPto0 vS0q2n4Oo3Mt5Jc025ZqaPXruWc6G+uQwcGOD2d6p4pCVACvC4reCWsmgPvvDH2JY6ip ZXjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Y1L8IHI11QecjqL/YZfNecRZyKoC5SoS8DJg/mA4eV0=; b=VMZJ6BVbWU8CcG/S+YfkGhUI+01Sxnkv9CFyyfP/0HzOnOqc8r++0SDbiFYUlJz9TF 6ADm1Wzji91yc1gIcN2DVD3SdMzlOh8EdKPDesT+YMTc+lCgO7jULmxQZ8pXNQ2bFmNT vAimSzoY6py51HIGkTZENDxLGJtbZ23LCvhSNdcEMwaUlZ/ZQoDFec+iJtqVeMwS1y2Z ey9fd9JIL/8pLdhSXSckk89phFWgtDKV3yhhBn9aYxP7Nflaz1Tn7nTDTRSmH7LTA5i4 K33phRWRh75X/xOw7UmAzN9SdxcyGCjZGqK9k7D9ww58Mj2G306bF1LoFTncS231h5CR PhDQ== X-Gm-Message-State: AKwxytepFjxXN4ZgKMTsokF6YTMZGW5ot1RYB1k+nc/geg2nt0+eZT+E 7PAdFrLJdoD/IDtvyct3+Jo1DU+K X-Google-Smtp-Source: ACJfBosjyalBnzfhMagq01Xw8eOiqObL+C2iiqO08GbD/XhVm9Ss29mP5e0hvwAUE2yowui7TzXj2A== X-Received: by 10.223.175.220 with SMTP id y28mr5566255wrd.263.1516279436556; Thu, 18 Jan 2018 04:43:56 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 13:43:46 +0100 Message-Id: <1516279431-30424-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516279431-30424-1-git-send-email-pbonzini@redhat.com> References: <1516279431-30424-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH 2/7] qcow2: make qcow2_co_create2() a coroutine_fn X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Stefan Hajnoczi , qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Stefan Hajnoczi qcow2_create2() calls qemu_co_mutex_lock(). Only a coroutine_fn may call another coroutine_fn. In fact, qcow2_create2 is always called from coroutine context. Rename the function to add the "co" moniker and add coroutine_fn. Reported-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Stefan Hajnoczi Message-Id: <20170705102231.20711-3-stefanha@redhat.com> Signed-off-by: Paolo Bonzini --- block/qcow2.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index be2d485..fec065b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2690,11 +2690,12 @@ static uint64_t qcow2_opt_get_refcount_bits_del(Qem= uOpts *opts, int version, return refcount_bits; } =20 -static int qcow2_create2(const char *filename, int64_t total_size, - const char *backing_file, const char *backing_for= mat, - int flags, size_t cluster_size, PreallocMode prea= lloc, - QemuOpts *opts, int version, int refcount_order, - const char *encryptfmt, Error **errp) +static int coroutine_fn +qcow2_co_create2(const char *filename, int64_t total_size, + const char *backing_file, const char *backing_format, + int flags, size_t cluster_size, PreallocMode prealloc, + QemuOpts *opts, int version, int refcount_order, + const char *encryptfmt, Error **errp) { QDict *options; =20 @@ -2963,9 +2964,9 @@ static int coroutine_fn qcow2_co_create(const char *f= ilename, QemuOpts *opts, =20 refcount_order =3D ctz32(refcount_bits); =20 - ret =3D qcow2_create2(filename, size, backing_file, backing_fmt, flags, - cluster_size, prealloc, opts, version, refcount_or= der, - encryptfmt, &local_err); + ret =3D qcow2_co_create2(filename, size, backing_file, backing_fmt, fl= ags, + cluster_size, prealloc, opts, version, refcount= _order, + encryptfmt, &local_err); error_propagate(errp, local_err); =20 finish: --=20 1.8.3.1