From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018950; cv=none; d=zohomail.com; s=zohoarc; b=Sn9kpGYDBKo1tbK6YZ39HueD/rPKNb2WNapwKKRPUcbMyCAeErw1N7vF7EipPWb0WLVaLNJuxhjzNW3ORRhjNwjaKzGuykQ4fXS9gQ6dgu7l92SDefC+P0dCzCu4w4G/aTb3i+EN1t+q7pRpU7Fn8fFKZicWJUy3qxLIkoFKNAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018950; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GPVs2kKtPRU8XSyl16h/2UIVKV6EOye4ZDdJCZn67ew=; b=k67yKEnFBse2W4l3nynQhi9bFAUjtMifoVkGs2stdsLWQa/3G7/Lkn7ME3ckgfuQq91gGWED4bGNatkQX+X+2FN0WByYwCIB6jcEn9jtoz3WL33Y2wTkncdX2zU3ZyjeUrMXCtUcY9tWdbxY457QwRSxrxP2U75Hlu9UKliX31g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018950545591.8604147436262; Thu, 25 May 2023 05:49:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2ANV-0007wl-18; Thu, 25 May 2023 08:47:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANT-0007vf-C9 for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANM-0001xr-Er for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-MAHHq4BmPh6sygt6cLIltQ-1; Thu, 25 May 2023 08:47:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53A8D811E7F; Thu, 25 May 2023 12:47:24 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54CCB9D73; Thu, 25 May 2023 12:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GPVs2kKtPRU8XSyl16h/2UIVKV6EOye4ZDdJCZn67ew=; b=bYZyS5YOKiq7QwBXXEJnxsi6tnV9OIbZ7f0+ydBHrnjy68H5f9U2AMDD2NvM9WeEINki/C 4TJl09MUCJUoHD+j7O++peDSV6TM9T4y8j7Uo/rsT01gl/1zKYY6DjeNyTsaJd5oFcv9os GyEN54xHWe62FcjWxAjhBDk+4zCcghI= X-MC-Unique: MAHHq4BmPh6sygt6cLIltQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 01/12] block-coroutine-wrapper: Take AioContext lock in no_co_wrappers Date: Thu, 25 May 2023 14:47:02 +0200 Message-Id: <20230525124713.401149-2-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018952428100001 Content-Type: text/plain; charset="utf-8" All of the functions that currently take a BlockDriverState, BdrvChild or BlockBackend as their first parameter expect the associated AioContext to be locked when they are called. In the case of no_co_wrappers, they are called from bottom halves directly in the main loop, so no other caller can be expected to take the lock for them. This can result in assertion failures because a lock that isn't taken is released in nested event loops. Looking at the first parameter is already done by co_wrappers to decide where the coroutine should run, so doing the same in no_co_wrappers is only consistent. Take the lock in the generated bottom halves to fix the problem. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- include/block/block-common.h | 3 +++ block/block-backend.c | 7 ++++++- scripts/block-coroutine-wrapper.py | 25 +++++++++++++++---------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/include/block/block-common.h b/include/block/block-common.h index 93196229ac..e15395f2cb 100644 --- a/include/block/block-common.h +++ b/include/block/block-common.h @@ -65,6 +65,9 @@ * scheduling a BH in the bottom half that runs the respective non-corouti= ne * function. The coroutine yields after scheduling the BH and is reentered= when * the wrapped function returns. + * + * If the first parameter of the function is a BlockDriverState, BdrvChild= or + * BlockBackend pointer, the AioContext lock for it is taken in the wrappe= r. */ #define no_co_wrapper =20 diff --git a/block/block-backend.c b/block/block-backend.c index ca537cd0ad..26447664ab 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2394,9 +2394,14 @@ void blk_op_unblock_all(BlockBackend *blk, Error *re= ason) =20 AioContext *blk_get_aio_context(BlockBackend *blk) { - BlockDriverState *bs =3D blk_bs(blk); + BlockDriverState *bs; IO_CODE(); =20 + if (!blk) { + return qemu_get_aio_context(); + } + + bs =3D blk_bs(blk); if (bs) { AioContext *ctx =3D bdrv_get_aio_context(blk_bs(blk)); assert(ctx =3D=3D blk->ctx); diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-w= rapper.py index 60e9b3107c..d4a183db61 100644 --- a/scripts/block-coroutine-wrapper.py +++ b/scripts/block-coroutine-wrapper.py @@ -88,16 +88,7 @@ def __init__(self, wrapper_type: str, return_type: str, = name: str, raise ValueError(f"no_co function can't be rdlock: {self.n= ame}") self.target_name =3D f'{subsystem}_{subname}' =20 - t =3D self.args[0].type - if t =3D=3D 'BlockDriverState *': - ctx =3D 'bdrv_get_aio_context(bs)' - elif t =3D=3D 'BdrvChild *': - ctx =3D 'bdrv_get_aio_context(child->bs)' - elif t =3D=3D 'BlockBackend *': - ctx =3D 'blk_get_aio_context(blk)' - else: - ctx =3D 'qemu_get_aio_context()' - self.ctx =3D ctx + self.ctx =3D self.gen_ctx() =20 self.get_result =3D 's->ret =3D ' self.ret =3D 'return s.ret;' @@ -109,6 +100,17 @@ def __init__(self, wrapper_type: str, return_type: str= , name: str, self.co_ret =3D '' self.return_field =3D '' =20 + def gen_ctx(self, prefix: str =3D '') -> str: + t =3D self.args[0].type + if t =3D=3D 'BlockDriverState *': + return f'bdrv_get_aio_context({prefix}bs)' + elif t =3D=3D 'BdrvChild *': + return f'bdrv_get_aio_context({prefix}child->bs)' + elif t =3D=3D 'BlockBackend *': + return f'blk_get_aio_context({prefix}blk)' + else: + return 'qemu_get_aio_context()' + def gen_list(self, format: str) -> str: return ', '.join(format.format_map(arg.__dict__) for arg in self.a= rgs) =20 @@ -262,8 +264,11 @@ def gen_no_co_wrapper(func: FuncDecl) -> str: static void {name}_bh(void *opaque) {{ {struct_name} *s =3D opaque; + AioContext *ctx =3D {func.gen_ctx('s->')}; =20 + aio_context_acquire(ctx); {func.get_result}{name}({ func.gen_list('s->{name}') }); + aio_context_release(ctx); =20 aio_co_wake(s->co); }} --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018931; cv=none; d=zohomail.com; s=zohoarc; b=UHu8Hg5ifml/sIbI7AAWr7VWZOl9rnjsx82IvJyWY078wpsM1+L0ZlwOen4Jyz+Z6iz/WFFiUAuOpw8sU2Pq0kWOy5WnbVKSjQbrI09uZ8fjpBd+6hjH+6AI8xcArXV+5nfniHWn8mKB7481mJNefLedaSpkKCgp6Ln4PXonIsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018931; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Obj4dnKiWNlZ5ovNKKF7LfDHhySfr7O3O9LZCEjkL38=; b=NbB1xrKPOxECWeYnktqX+jmxUnvR3LShEWMKVSPfd7J3qPAME4MnEPhbqvylpwAqNty9QywUE92w60aHDB8TyHROlJPU2NIQ1JDhSN/YJR5/yKQY/UwlxbJH//xKroYAkCQu+esWENjVoE4MKzf2YLuDiF3nvkunxbb0CZaFPkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018931418232.64616863572996; Thu, 25 May 2023 05:48:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2ANX-0007yP-CI; Thu, 25 May 2023 08:47:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANQ-0007v7-Ql for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANO-0001y4-QR for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:32 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-271-HJywGLqPP_GqAOvTs-cS2g-1; Thu, 25 May 2023 08:47:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86347101A53A; Thu, 25 May 2023 12:47:25 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B1FD8162; Thu, 25 May 2023 12:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Obj4dnKiWNlZ5ovNKKF7LfDHhySfr7O3O9LZCEjkL38=; b=V8Vig2XHCpxXpWKuQbYjW+BXlZzTCujf7TKsCLe+i7xnKlkOYz6+IMDN1AbAVyY7Pwyimq eaYIP/P6WKCPnLkmc0TWAh3Kqr+Pg/Xwbg0tg5UF/lxR0vaOJDitw69hLboy22Zyks4dib bQCKJz7euQV+EcF6/T0geoqG3RuNpf0= X-MC-Unique: HJywGLqPP_GqAOvTs-cS2g-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 02/12] block: Clarify locking rules for bdrv_open(_inherit)() Date: Thu, 25 May 2023 14:47:03 +0200 Message-Id: <20230525124713.401149-3-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018933050100003 Content-Type: text/plain; charset="utf-8" These functions specify that the caller must hold the "@filename AioContext lock". This doesn't make sense, file names don't have an AioContext. New BlockDriverStates always start in the main AioContext, so this is what we really need here. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index a2f8d5a0c0..6ac47112fe 100644 --- a/block.c +++ b/block.c @@ -3810,9 +3810,7 @@ out: * should be opened. If specified, neither options nor a filename may be g= iven, * nor can an existing BDS be reused (that is, *pbs has to be NULL). * - * The caller must always hold @filename AioContext lock, because this - * function eventually calls bdrv_refresh_total_sectors() which polls - * when called from non-coroutine context. + * The caller must always hold the main AioContext lock. */ static BlockDriverState * no_coroutine_fn bdrv_open_inherit(const char *filename, const char *reference, QDict *opti= ons, @@ -4100,11 +4098,7 @@ close_and_fail: return NULL; } =20 -/* - * The caller must always hold @filename AioContext lock, because this - * function eventually calls bdrv_refresh_total_sectors() which polls - * when called from non-coroutine context. - */ +/* The caller must always hold the main AioContext lock. */ BlockDriverState *bdrv_open(const char *filename, const char *reference, QDict *options, int flags, Error **errp) { --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018904; cv=none; d=zohomail.com; s=zohoarc; b=A0RgzJH2a2CeKJZb+WeACWPLjj5WXLiHAoSKesfNKkgtR7ENVjwS6oh/qGwdd1QfUA1BmOi61MGWXzuh7/F54Hn84rRjgpAKjpbi1g1TCx+UG9MbUCQI0LIj9uJGl7LBmf6npDnNwyec5ffZ3hWnbsluDw70Y5P8LLt3rQccs9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018904; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RKkKHzXgS2PPX+w5k39Umu5vzsksP4vcquR4S3KdeIM=; b=c16H4XXXzPVJua+uvFMZIRa9tuCA8p88jfsaOxFcm9/37/q2OYOEQXqlGnbGHQ+0hfEG9/hn6JVjFRcIbBDUHUQgL/DD2iMmUycwEPrPas3EXJSruzIKKnXl6IzsJAZt+21myy3IM0IiVUF6x5/Ju59Uu3CaCMJtvGqH5JISxH4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018904581386.6217369564496; Thu, 25 May 2023 05:48:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2ANU-0007va-2M; Thu, 25 May 2023 08:47:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANP-0007uu-JE for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANN-0001yI-B2 for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:31 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-s9JUAFMGOiSgSkmW30eepQ-1; Thu, 25 May 2023 08:47:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3CA6185A792; Thu, 25 May 2023 12:47:26 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFF2A8162; Thu, 25 May 2023 12:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RKkKHzXgS2PPX+w5k39Umu5vzsksP4vcquR4S3KdeIM=; b=DaxlM1jTiJIoKx6X5oUXk0uq2Tlmo6bz/lXNWiTqaCHL6O1sng1aIsWZTtiMeGAlXmD1/G VIyEZPV6dxZMb+1Zaf9d38+hIbKgx0R4LsKCqoIaFGLVU78p9xU5Ako03p/P05khygZbKt EObAFoVJvP6hOylN5z8rhCekI//ZDFk= X-MC-Unique: s9JUAFMGOiSgSkmW30eepQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 03/12] block: Take main AioContext lock when calling bdrv_open() Date: Thu, 25 May 2023 14:47:04 +0200 Message-Id: <20230525124713.401149-4-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018906179100001 Content-Type: text/plain; charset="utf-8" The function documentation already says that all callers must hold the main AioContext lock, but not all of them do. This can cause assertion failures when functions called by bdrv_open() try to drop the lock. Fix a few more callers to take the lock before calling bdrv_open(). Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c | 3 +++ block/block-backend.c | 2 ++ block/qapi-sysemu.c | 3 +++ blockdev.c | 29 +++++++++++++++++++++++------ qemu-nbd.c | 4 ++++ tests/unit/test-block-iothread.c | 3 +++ 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/block.c b/block.c index 6ac47112fe..79bc9c01de 100644 --- a/block.c +++ b/block.c @@ -7037,6 +7037,8 @@ void bdrv_img_create(const char *filename, const char= *fmt, return; } =20 + aio_context_acquire(qemu_get_aio_context()); + /* Create parameter list */ create_opts =3D qemu_opts_append(create_opts, drv->create_opts); create_opts =3D qemu_opts_append(create_opts, proto_drv->create_opts); @@ -7186,6 +7188,7 @@ out: qemu_opts_del(opts); qemu_opts_free(create_opts); error_propagate(errp, local_err); + aio_context_release(qemu_get_aio_context()); } =20 AioContext *bdrv_get_aio_context(BlockDriverState *bs) diff --git a/block/block-backend.c b/block/block-backend.c index 26447664ab..1d89fabd35 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -452,7 +452,9 @@ BlockBackend *blk_new_open(const char *filename, const = char *reference, } =20 blk =3D blk_new(qemu_get_aio_context(), perm, shared); + aio_context_acquire(qemu_get_aio_context()); bs =3D bdrv_open(filename, reference, options, flags, errp); + aio_context_release(qemu_get_aio_context()); if (!bs) { blk_unref(blk); return NULL; diff --git a/block/qapi-sysemu.c b/block/qapi-sysemu.c index cec3c1afb4..ef07151892 100644 --- a/block/qapi-sysemu.c +++ b/block/qapi-sysemu.c @@ -362,7 +362,10 @@ void qmp_blockdev_change_medium(const char *device, qdict_put_str(options, "driver", format); } =20 + aio_context_acquire(qemu_get_aio_context()); medium_bs =3D bdrv_open(filename, NULL, options, bdrv_flags, errp); + aio_context_release(qemu_get_aio_context()); + if (!medium_bs) { goto fail; } diff --git a/blockdev.c b/blockdev.c index 5d56b79df4..db2725fe74 100644 --- a/blockdev.c +++ b/blockdev.c @@ -662,6 +662,7 @@ err_no_opts: /* Takes the ownership of bs_opts */ BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp) { + BlockDriverState *bs; int bdrv_flags =3D 0; =20 GLOBAL_STATE_CODE(); @@ -676,7 +677,11 @@ BlockDriverState *bds_tree_init(QDict *bs_opts, Error = **errp) bdrv_flags |=3D BDRV_O_INACTIVE; } =20 - return bdrv_open(NULL, NULL, bs_opts, bdrv_flags, errp); + aio_context_acquire(qemu_get_aio_context()); + bs =3D bdrv_open(NULL, NULL, bs_opts, bdrv_flags, errp); + aio_context_release(qemu_get_aio_context()); + + return bs; } =20 void blockdev_close_all_bdrv_states(void) @@ -1480,14 +1485,20 @@ static void external_snapshot_action(TransactionAct= ion *action, } qdict_put_str(options, "driver", format); } + aio_context_release(aio_context); =20 + aio_context_acquire(qemu_get_aio_context()); state->new_bs =3D bdrv_open(new_image_file, snapshot_ref, options, fla= gs, errp); + aio_context_release(qemu_get_aio_context()); + /* We will manually add the backing_hd field to the bs later */ if (!state->new_bs) { - goto out; + return; } =20 + aio_context_acquire(aio_context); + /* * Allow attaching a backing file to an overlay that's already in use = only * if the parents don't assume that they are already seeing a valid im= age. @@ -1732,15 +1743,18 @@ static void drive_backup_action(DriveBackup *backup, if (format) { qdict_put_str(options, "driver", format); } + aio_context_release(aio_context); =20 + aio_context_acquire(qemu_get_aio_context()); target_bs =3D bdrv_open(backup->target, NULL, options, flags, errp); + aio_context_release(qemu_get_aio_context()); + if (!target_bs) { - goto out; + return; } =20 /* Honor bdrv_try_change_aio_context() context acquisition requirement= s. */ old_context =3D bdrv_get_aio_context(target_bs); - aio_context_release(aio_context); aio_context_acquire(old_context); =20 ret =3D bdrv_try_change_aio_context(target_bs, aio_context, NULL, errp= ); @@ -3066,13 +3080,17 @@ void qmp_drive_mirror(DriveMirror *arg, Error **err= p) if (format) { qdict_put_str(options, "driver", format); } + aio_context_release(aio_context); =20 /* Mirroring takes care of copy-on-write using the source's backing * file. */ + aio_context_acquire(qemu_get_aio_context()); target_bs =3D bdrv_open(arg->target, NULL, options, flags, errp); + aio_context_release(qemu_get_aio_context()); + if (!target_bs) { - goto out; + return; } =20 zero_target =3D (arg->sync =3D=3D MIRROR_SYNC_MODE_FULL && @@ -3082,7 +3100,6 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) =20 /* Honor bdrv_try_change_aio_context() context acquisition requirement= s. */ old_context =3D bdrv_get_aio_context(target_bs); - aio_context_release(aio_context); aio_context_acquire(old_context); =20 ret =3D bdrv_try_change_aio_context(target_bs, aio_context, NULL, errp= ); diff --git a/qemu-nbd.c b/qemu-nbd.c index 6ff45308a9..4276163564 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -1071,7 +1071,11 @@ int main(int argc, char **argv) qdict_put_str(raw_opts, "driver", "raw"); qdict_put_str(raw_opts, "file", bs->node_name); qdict_put_int(raw_opts, "offset", dev_offset); + + aio_context_acquire(qemu_get_aio_context()); bs =3D bdrv_open(NULL, NULL, raw_opts, flags, &error_fatal); + aio_context_release(qemu_get_aio_context()); + blk_remove_bs(blk); blk_insert_bs(blk, bs, &error_fatal); bdrv_unref(bs); diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothr= ead.c index 3a5e1eb2c4..1b40e65bad 100644 --- a/tests/unit/test-block-iothread.c +++ b/tests/unit/test-block-iothread.c @@ -833,8 +833,11 @@ static void test_attach_second_node(void) qdict_put_str(options, "driver", "raw"); qdict_put_str(options, "file", "base"); =20 + /* FIXME raw_open() should take ctx's lock internally */ aio_context_acquire(ctx); + aio_context_acquire(main_ctx); filter =3D bdrv_open(NULL, NULL, options, BDRV_O_RDWR, &error_abort); + aio_context_release(main_ctx); aio_context_release(ctx); =20 g_assert(blk_get_aio_context(blk) =3D=3D ctx); --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018921; cv=none; d=zohomail.com; s=zohoarc; b=I+H6Ok70Urdv0clcqbcbKhVjE2S5FGxE97r31h12jtzabDcHvnmoRyQ5gwayUEN2qm9yuMoV8Bde2zc7THPg8FaeX6oGuZJic8IXinxgMZJp1gWv5oE6fUmIRqEowjYYWEj55LjJfe/M3+bsfWfJDVVxz+DGxvB7Gt0cdjIUrjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018921; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8cYAKXS3/YhNEEtr1xEC8ECSt+c2Jfm+QTPioXYg2qw=; b=GAFhIF57vuv5RDeOuztvQq+5DtJRvwiGsteIMr+HFlihnpMsw/OxHw45tj+UKrAoaV225X0pqPeqXEY1JlhlQRNX7kn1RxMFOshQE2DC/wrloaIkL1TgJP9BwkpOTYlgJ97YREqt+iIqtggWNZ1XbQS9YtVGSlO1ddf6wxDiJIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018921025430.5775766776144; Thu, 25 May 2023 05:48:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AOF-0000wa-TL; Thu, 25 May 2023 08:48:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANu-0008DN-VH for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANc-00021G-IY for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:02 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-153-lcGlgijmNby_77FT6gmt6Q-1; Thu, 25 May 2023 08:47:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1ABBE800B2A; Thu, 25 May 2023 12:47:28 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1782F7AF5; Thu, 25 May 2023 12:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8cYAKXS3/YhNEEtr1xEC8ECSt+c2Jfm+QTPioXYg2qw=; b=d2tLL/3pJVJMCVE8gdbhzBT9bPNJTZ/n4w83lnJkC6s1AyGfRlwWe0FIWuIl3htbMHDius 9x+3Zcg33QRUisMXteAPO+TtRJlbl+0ZmNkb1RChfZFA2WtEMxppvKb21RgGTRDITFm+Ob mySydgD/rK6++ktYX9LFgOkcrsoJFHU= X-MC-Unique: lcGlgijmNby_77FT6gmt6Q-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 04/12] block-backend: Fix blk_new_open() for iothreads Date: Thu, 25 May 2023 14:47:05 +0200 Message-Id: <20230525124713.401149-5-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018923025100003 Content-Type: text/plain; charset="utf-8" This fixes blk_new_open() to not assume that bs is in the main context. In particular, the BlockBackend must be created with the right AioContext because it will refuse to move to a different context afterwards. (blk->allow_aio_context_change is false.) Use this opportunity to use blk_insert_bs() instead of duplicating the bdrv_root_attach_child() call. This is consistent with what blk_new_with_bs() does. Add comments to document the locking rules. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block/block-backend.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 1d89fabd35..dde60e0f71 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -389,6 +389,8 @@ BlockBackend *blk_new(AioContext *ctx, uint64_t perm, u= int64_t shared_perm) * Both sets of permissions can be changed later using blk_set_perm(). * * Return the new BlockBackend on success, null on failure. + * + * Callers must hold the AioContext lock of @bs. */ BlockBackend *blk_new_with_bs(BlockDriverState *bs, uint64_t perm, uint64_t shared_perm, Error **errp) @@ -406,11 +408,15 @@ BlockBackend *blk_new_with_bs(BlockDriverState *bs, u= int64_t perm, =20 /* * Creates a new BlockBackend, opens a new BlockDriverState, and connects = both. - * The new BlockBackend is in the main AioContext. + * By default, the new BlockBackend is in the main AioContext, but if the + * parameters connect it with any existing node in a different AioContext,= it + * may end up there instead. * * Just as with bdrv_open(), after having called this function the referen= ce to * @options belongs to the block layer (even on failure). * + * Called without holding an AioContext lock. + * * TODO: Remove @filename and @flags; it should be possible to specify a w= hole * BDS tree just by specifying the @options QDict (or @reference, * alternatively). At the time of adding this function, this is not possib= le, @@ -422,6 +428,7 @@ BlockBackend *blk_new_open(const char *filename, const = char *reference, { BlockBackend *blk; BlockDriverState *bs; + AioContext *ctx; uint64_t perm =3D 0; uint64_t shared =3D BLK_PERM_ALL; =20 @@ -451,18 +458,24 @@ BlockBackend *blk_new_open(const char *filename, cons= t char *reference, shared =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED; } =20 - blk =3D blk_new(qemu_get_aio_context(), perm, shared); aio_context_acquire(qemu_get_aio_context()); bs =3D bdrv_open(filename, reference, options, flags, errp); aio_context_release(qemu_get_aio_context()); if (!bs) { - blk_unref(blk); return NULL; } =20 - blk->root =3D bdrv_root_attach_child(bs, "root", &child_root, - BDRV_CHILD_FILTERED | BDRV_CHILD_PR= IMARY, - perm, shared, blk, errp); + /* bdrv_open() could have moved bs to a different AioContext */ + ctx =3D bdrv_get_aio_context(bs); + blk =3D blk_new(bdrv_get_aio_context(bs), perm, shared); + blk->perm =3D perm; + blk->shared_perm =3D shared; + + aio_context_acquire(ctx); + blk_insert_bs(blk, bs, errp); + bdrv_unref(bs); + aio_context_release(ctx); + if (!blk->root) { blk_unref(blk); return NULL; @@ -903,6 +916,8 @@ void blk_remove_bs(BlockBackend *blk) =20 /* * Associates a new BlockDriverState with @blk. + * + * Callers must hold the AioContext lock of @bs. */ int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp) { --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018899; cv=none; d=zohomail.com; s=zohoarc; b=aQ0chNZZaXCgn7taW4Rr6jQ8CFEyOBAgRBrz0uRR4LS82SyE3/LzzyqJRJFN283/BkOLzV3OYm0MdEwf3rCLUjCngpD2pnkQsOJuONwy87OgOnw2JhnyZvbxvp4s9qJdGsZeBZlPly2Ta5kReiJipl2WPRn9azyimbG95zl3CQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018899; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=051AE6V7xY7ZlAOEC8ZQs+l53uCfZzE58ah4xTn0ORA=; b=VS39qfNl37sjuOmDHcxKBEqU6M5yLBRiiDr0u2PhGsq3RN9oCfVdfSxznheTlCP2Yh3fHISVgiTtXlsdDzT8YjfGwVeDOyxHCpt6sLk2DgokVJqreTgZnrJJgRsTrlO9G3KNsTkoTZLwzPm5dXQfuJUZa0U3wNEWHEetVymQQd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018899610274.3354084638802; Thu, 25 May 2023 05:48:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2ANf-0007yu-U8; Thu, 25 May 2023 08:47:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANU-0007wO-Kz for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANP-0001yu-LH for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:36 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-532-kWVh3NygPQGaIc1cSwOa-g-1; Thu, 25 May 2023 08:47:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A38B3C13506; Thu, 25 May 2023 12:47:29 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 528FD8162; Thu, 25 May 2023 12:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=051AE6V7xY7ZlAOEC8ZQs+l53uCfZzE58ah4xTn0ORA=; b=g2UWh3ij8C5ZvesHd4+/3Akn+ud22nPvEG4JypeIsEw0qTxPmzGJrfESJ9YErT1PoXb/vy 6vGWoFV7okqRwI93U2UPGccxUMm5ZNrZm7iUI/fc1SEcZ+J0qfOoQJS4Cw41BZ8zuruDcL NUUvLDpI7hhFcbnwSCyzuC4vKd9bnvY= X-MC-Unique: kWVh3NygPQGaIc1cSwOa-g-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 05/12] mirror: Hold main AioContext lock for calling bdrv_open_backing_file() Date: Thu, 25 May 2023 14:47:06 +0200 Message-Id: <20230525124713.401149-6-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018901114100003 Content-Type: text/plain; charset="utf-8" bdrv_open_backing_file() calls bdrv_open_inherit(), so all callers must hold the main AioContext lock. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c | 2 ++ block/mirror.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/block.c b/block.c index 79bc9c01de..be9ae364fb 100644 --- a/block.c +++ b/block.c @@ -3478,6 +3478,8 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDr= iverState *backing_hd, * itself, all options starting with "${bdref_key}." are considered part o= f the * BlockdevRef. * + * The caller must hold the main AioContext lock. + * * TODO Can this be unified with bdrv_open_image()? */ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options, diff --git a/block/mirror.c b/block/mirror.c index b7d92d1378..d3cacd1708 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -662,11 +662,15 @@ static int mirror_exit_common(Job *job) bool abort =3D job->ret < 0; int ret =3D 0; =20 + GLOBAL_STATE_CODE(); + if (s->prepared) { return 0; } s->prepared =3D true; =20 + aio_context_acquire(qemu_get_aio_context()); + mirror_top_bs =3D s->mirror_top_bs; bs_opaque =3D mirror_top_bs->opaque; src =3D mirror_top_bs->backing->bs; @@ -789,6 +793,8 @@ static int mirror_exit_common(Job *job) bdrv_unref(mirror_top_bs); bdrv_unref(src); =20 + aio_context_release(qemu_get_aio_context()); + return ret; } =20 --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018872; cv=none; d=zohomail.com; s=zohoarc; b=atCv4PsYG/NNzH1tI63Y7hUU4Efm1oL6h/6IiIBeHzzkmkwyovBOesHIU1Uh5mAtUAbcyDSJsrXWbXSKXXOD+9MtxFDsR6bBTmDM07qfcqTaGoB27AUB7Jfzk2azFY/qdB5XXDW22Fl/Zpn1wFHj+TPsZxqfw0GKSgJtkJ+yCKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018872; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SzPVRx3SpG8K/P12nVcLZ+sMp9q+PLUAJ01e7rH3vVU=; b=Nr4a/XCKvYqsZqTaJyYSmha1YQED0HJ0OrKsNpt/4HSmMNayxALuaz2kPts2ugmCBEWN0d3fVB44vS+XO2vStZmjxm/3AuvbfVwYK14ubYkXEV15tB7PXofQDaS/Eq+9QOTO09BcmCp+aFh6se/M3xxTjdpHAyaYZae7eye4Tw8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018872709238.34888928648422; Thu, 25 May 2023 05:47:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2ANV-0007x9-98; Thu, 25 May 2023 08:47:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANT-0007vg-Eg for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANQ-0001zO-VM for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-104-6VDcqu9sPYO5jN4oiIE--A-1; Thu, 25 May 2023 08:47:30 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EE3A85A5B5; Thu, 25 May 2023 12:47:30 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E8067AF5; Thu, 25 May 2023 12:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SzPVRx3SpG8K/P12nVcLZ+sMp9q+PLUAJ01e7rH3vVU=; b=KYAgKUrAHPDJJk/4dj3SuUd5Nb9RwIoUG6A6/wRoq+h8rB1T7r+/b+o4xT5mJ6Mb/u2r+h sWhSxbkYtch3UMs4vFeGJFB43BlN0c2MNS0JfJKlFLef7QLRBGbzhV5lgyhx8NLc9Zq38l btgxaxt+AzHC0hkU0w9F1qzCD21unIk= X-MC-Unique: 6VDcqu9sPYO5jN4oiIE--A-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 06/12] qcow2: Fix open with 'file' in iothread Date: Thu, 25 May 2023 14:47:07 +0200 Message-Id: <20230525124713.401149-7-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018874031100002 Content-Type: text/plain; charset="utf-8" qcow2_open() doesn't work correctly when opening the 'file' child moves bs to an iothread, for several reasons: - It uses BDRV_POLL_WHILE() to wait for the qcow2_open_entry() coroutine, which involves dropping the AioContext lock for bs when it is not in the main context - but we don't hold it, so this crashes. - It runs the qcow2_open_entry() coroutine in the current thread instead of the new AioContext of bs. - qcow2_open_entry() doesn't notify the main loop when it's done. This patches fixes these issues around delegating work to a coroutine. Temporarily dropping the main AioContext lock is not necessary because we know we run in the main thread. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index b00b4e7575..7f3948360d 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1904,6 +1904,8 @@ static void coroutine_fn qcow2_open_entry(void *opaqu= e) qoc->ret =3D qcow2_do_open(qoc->bs, qoc->options, qoc->flags, true, qoc->errp); qemu_co_mutex_unlock(&s->lock); + + aio_wait_kick(); } =20 static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, @@ -1929,8 +1931,10 @@ static int qcow2_open(BlockDriverState *bs, QDict *o= ptions, int flags, =20 assert(!qemu_in_coroutine()); assert(qemu_get_current_aio_context() =3D=3D qemu_get_aio_context()); - qemu_coroutine_enter(qemu_coroutine_create(qcow2_open_entry, &qoc)); - BDRV_POLL_WHILE(bs, qoc.ret =3D=3D -EINPROGRESS); + + aio_co_enter(bdrv_get_aio_context(bs), + qemu_coroutine_create(qcow2_open_entry, &qoc)); + AIO_WAIT_WHILE_UNLOCKED(NULL, qoc.ret =3D=3D -EINPROGRESS); =20 return qoc.ret; } --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018975; cv=none; d=zohomail.com; s=zohoarc; b=b+bJVFQMDRgkluv+Y5icpvI2FrMGX3MVjORvalV44Uf9GRS2LJ9PGC/LaupThSa50RYXby0iCHLBED9yrNVcPYoGskByqKLfdgzSYlLDYPWLy9Sg3pJbDSMQuL9uYltEbxj4UJQ9bYlN/B7Auu47voeTrdRFyQApuh7SnYT8/80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018975; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S3qjAqClO90U/CNeVD+Ipc2N7sAsydoXmUm4UwjsvtI=; b=cSU8G6nsPN+0ovR0In5Unq+RwSQWLwTbWWKfsG6ZZHTRUaN9hF8akyTp/1ZFNiwRUJYI/go0imbwQplGNFDqAO0GjH2+iVHLRWiuCiZYnGwUzyvQSR9vDQ2nMKLXwo945HPlbG1tpOPGkKNtqV+DdOLpVCnjOtEzIOorMNys/qk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018975494684.0060391890634; Thu, 25 May 2023 05:49:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AO1-0008NR-Je; Thu, 25 May 2023 08:48:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANt-00087Z-2X for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANU-00020Q-AO for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:42 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-399-d-Kav6EROx26NGPyuRCAJA-1; Thu, 25 May 2023 08:47:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF283800141; Thu, 25 May 2023 12:47:31 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id C70519E63; Thu, 25 May 2023 12:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S3qjAqClO90U/CNeVD+Ipc2N7sAsydoXmUm4UwjsvtI=; b=cf5jZty+rpdijq/daGBw8+bQOJn+7wH6rK4dU5X3LC+3tcOqaXr+5ZiBaZGv0f6RhBD/Kz 5Xk2XjHKZuh1onIYVP/CSNvqso6jRqzV67Ubs5lEAtk3KJPqfxhnYjoVft+wva3ugc514Q q61Zub9e9LdH5jCw0l98shAnTdnRey4= X-MC-Unique: d-Kav6EROx26NGPyuRCAJA-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 07/12] raw-format: Fix open with 'file' in iothread Date: Thu, 25 May 2023 14:47:08 +0200 Message-Id: <20230525124713.401149-8-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018976353100001 Content-Type: text/plain; charset="utf-8" When opening the 'file' child moves bs to an iothread, we need to hold the AioContext lock of it before we can call raw_apply_options() (and more specifically, bdrv_getlength() inside of it). Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block/raw-format.c | 5 +++++ tests/unit/test-block-iothread.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/block/raw-format.c b/block/raw-format.c index 918fe4fb7e..e4f35268e6 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -468,6 +468,7 @@ static int raw_open(BlockDriverState *bs, QDict *option= s, int flags, Error **errp) { BDRVRawState *s =3D bs->opaque; + AioContext *ctx; bool has_size; uint64_t offset, size; BdrvChildRole file_role; @@ -515,7 +516,11 @@ static int raw_open(BlockDriverState *bs, QDict *optio= ns, int flags, bs->file->bs->filename); } =20 + ctx =3D bdrv_get_aio_context(bs); + aio_context_acquire(ctx); ret =3D raw_apply_options(bs, s, offset, has_size, size, errp); + aio_context_release(ctx); + if (ret < 0) { return ret; } diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothr= ead.c index 1b40e65bad..f081c09729 100644 --- a/tests/unit/test-block-iothread.c +++ b/tests/unit/test-block-iothread.c @@ -833,12 +833,9 @@ static void test_attach_second_node(void) qdict_put_str(options, "driver", "raw"); qdict_put_str(options, "file", "base"); =20 - /* FIXME raw_open() should take ctx's lock internally */ - aio_context_acquire(ctx); aio_context_acquire(main_ctx); filter =3D bdrv_open(NULL, NULL, options, BDRV_O_RDWR, &error_abort); aio_context_release(main_ctx); - aio_context_release(ctx); =20 g_assert(blk_get_aio_context(blk) =3D=3D ctx); g_assert(bdrv_get_aio_context(bs) =3D=3D ctx); --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018918; cv=none; d=zohomail.com; s=zohoarc; b=czHaLlLe0uDqIIUL6SBM8VWfayL4stk1V2KfdXb5hAS7FCzY9Cz3ApsSVfvmK9OCDM5wWGxTf7QvB2vpIWuwReS31k9hvkhDtQMFaj4N/0hK9bYkxBpSOsbmPgWe3LYlSyS6F5bdXpfWU/lFdbDIsABDC30///FNzh4SOOy7fo0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018918; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KKRy99Whp5k3dwJu4J4iC5wTaUNX+jBQIxXZEQ8DDA8=; b=n3K+ecEsjMxdrS7XaARfWzcndIZTGC+tUmqiBgTmA3a8FMCvyoDav90JMkCilwdk8O9DXNZj/2pwF0jhuE1UPtYBKEXX/z06VOymAFqMunI+G5Ea9tfmUfZ+053MbA4/Z6zTDwLyeyg/pZXjcJBeRmXSyv5g09QUVALIBygqzHU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018918111439.2168428205956; Thu, 25 May 2023 05:48:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AO0-0008LL-Fa; Thu, 25 May 2023 08:48:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANt-00087f-3n for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANU-00020X-7J for qemu-devel@nongnu.org; Thu, 25 May 2023 08:47:37 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-418-Dczj6oFVNU65SuZzvYfPQA-1; Thu, 25 May 2023 08:47:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 117732A59541; Thu, 25 May 2023 12:47:33 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A7C07AF5; Thu, 25 May 2023 12:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KKRy99Whp5k3dwJu4J4iC5wTaUNX+jBQIxXZEQ8DDA8=; b=QdvkofdbbVcrIz90LNCa2/N2BO8/RkollfDpy65qUX/Z3DBvpXQlXpiV+SH3SAsBMIIR/w WzNryQcKUzzzpo7/mF0dqFdC7FqAwbzqc25q0mHrOCzL9LtNpwrnKhD1Ah9R7NCzyxi5UW bkEJGeozRZTE8qJxmB7PtSl8s+u8fcM= X-MC-Unique: Dczj6oFVNU65SuZzvYfPQA-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 08/12] copy-before-write: Fix open with child in iothread Date: Thu, 25 May 2023 14:47:09 +0200 Message-Id: <20230525124713.401149-9-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018920074100004 Content-Type: text/plain; charset="utf-8" The AioContext lock must not be held for bdrv_open_child(), but it is necessary for the followig operations, in particular those using nested event loops in coroutine wrappers. Temporarily dropping the main AioContext lock is not necessary because we know we run in the main thread. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block/copy-before-write.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 646d8227a4..b866e42271 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -412,6 +412,7 @@ static int cbw_open(BlockDriverState *bs, QDict *option= s, int flags, int64_t cluster_size; g_autoptr(BlockdevOptions) full_opts =3D NULL; BlockdevOptionsCbw *opts; + AioContext *ctx; int ret; =20 full_opts =3D cbw_parse_options(options, errp); @@ -432,11 +433,15 @@ static int cbw_open(BlockDriverState *bs, QDict *opti= ons, int flags, return -EINVAL; } =20 + ctx =3D bdrv_get_aio_context(bs); + aio_context_acquire(ctx); + if (opts->bitmap) { bitmap =3D block_dirty_bitmap_lookup(opts->bitmap->node, opts->bitmap->name, NULL, errp); if (!bitmap) { - return -EINVAL; + ret =3D -EINVAL; + goto out; } } s->on_cbw_error =3D opts->has_on_cbw_error ? opts->on_cbw_error : @@ -454,21 +459,24 @@ static int cbw_open(BlockDriverState *bs, QDict *opti= ons, int flags, s->bcs =3D block_copy_state_new(bs->file, s->target, bitmap, errp); if (!s->bcs) { error_prepend(errp, "Cannot create block-copy-state: "); - return -EINVAL; + ret =3D -EINVAL; + goto out; } =20 cluster_size =3D block_copy_cluster_size(s->bcs); =20 s->done_bitmap =3D bdrv_create_dirty_bitmap(bs, cluster_size, NULL, er= rp); if (!s->done_bitmap) { - return -EINVAL; + ret =3D -EINVAL; + goto out; } bdrv_disable_dirty_bitmap(s->done_bitmap); =20 /* s->access_bitmap starts equal to bcs bitmap */ s->access_bitmap =3D bdrv_create_dirty_bitmap(bs, cluster_size, NULL, = errp); if (!s->access_bitmap) { - return -EINVAL; + ret =3D -EINVAL; + goto out; } bdrv_disable_dirty_bitmap(s->access_bitmap); bdrv_dirty_bitmap_merge_internal(s->access_bitmap, @@ -478,7 +486,10 @@ static int cbw_open(BlockDriverState *bs, QDict *optio= ns, int flags, qemu_co_mutex_init(&s->lock); QLIST_INIT(&s->frozen_read_reqs); =20 - return 0; + ret =3D 0; +out: + aio_context_release(ctx); + return ret; } =20 static void cbw_close(BlockDriverState *bs) --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018982; cv=none; d=zohomail.com; s=zohoarc; b=HyTGk9utIwio7o2wgpnUBk6s7a2rEpTTcvOHk+Q/PMOxt8ryZxY1Ku9jpx1IX3rIeTJDBRP/y+L5QoXfLaKpZsC9/rTOi19oKeVU4frkLCE2yxeewo3BKmnAotrDdZmhDL4w8sSF26mJ0LCby/DONdBuuWLm9echQck+7HWtgTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018982; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y0K5Asqj4Uud3Vi5s3FniNSdo4dtDJ/tUWbyu/pEXTY=; b=InHPggmJTdkbi8maT+4ywAl9ib1RwpL8VV6cBcXT5AKpjAsipErieNL90jLnxpGkSwI6yRAChDM69Qu1GAqhJRl4AFR/zKF4vpHHQaFbGZ2QSOlF98xL4COHCJ1isyegbc6IfxZo4h9LIJyGFmrJboUAKh8qXbtSM5LTPDBNfyw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018982516151.85850446354038; Thu, 25 May 2023 05:49:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AO6-0000Fo-QG; Thu, 25 May 2023 08:48:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANw-0008Gs-WB for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANs-00021b-TI for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:04 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-82ly8gzHN_elPrjMTMN3SA-1; Thu, 25 May 2023 08:47:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 532F73C13501; Thu, 25 May 2023 12:47:34 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 485278162; Thu, 25 May 2023 12:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y0K5Asqj4Uud3Vi5s3FniNSdo4dtDJ/tUWbyu/pEXTY=; b=He4v5UAFIHqDGzI6ZOWjuSrYFQ6ChCwi1EUP513gmY2zHbDGb4bWkL/aguGq0jeVsbVTvX TYJrkzeaM+fRNem9IjshpEPAGhQrIhsXeeVaje4pyrOyswaAMlVIbWKctbSxSnXg6YvFU3 ob1/h/1Hr4JlcQ3M5gTO9PUvSvPlh8Y= X-MC-Unique: 82ly8gzHN_elPrjMTMN3SA-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 09/12] block: Take AioContext lock in bdrv_open_driver() Date: Thu, 25 May 2023 14:47:10 +0200 Message-Id: <20230525124713.401149-10-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018983270100001 Content-Type: text/plain; charset="utf-8" bdrv_refresh_total_sectors() and bdrv_refresh_limits() expect to be called under the AioContext lock of the node. Take the lock. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block.c b/block.c index be9ae364fb..e368a43761 100644 --- a/block.c +++ b/block.c @@ -1613,6 +1613,7 @@ static int no_coroutine_fn GRAPH_UNLOCKED bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_= name, QDict *options, int open_flags, Error **errp) { + AioContext *ctx; Error *local_err =3D NULL; int i, ret; GLOBAL_STATE_CODE(); @@ -1660,15 +1661,21 @@ bdrv_open_driver(BlockDriverState *bs, BlockDriver = *drv, const char *node_name, bs->supported_read_flags |=3D BDRV_REQ_REGISTERED_BUF; bs->supported_write_flags |=3D BDRV_REQ_REGISTERED_BUF; =20 + /* Get the context after .bdrv_open, it can change the context */ + ctx =3D bdrv_get_aio_context(bs); + aio_context_acquire(ctx); + ret =3D bdrv_refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { error_setg_errno(errp, -ret, "Could not refresh total sector count= "); + aio_context_release(ctx); return ret; } =20 bdrv_graph_rdlock_main_loop(); bdrv_refresh_limits(bs, NULL, &local_err); bdrv_graph_rdunlock_main_loop(); + aio_context_release(ctx); =20 if (local_err) { error_propagate(errp, local_err); --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018933; cv=none; d=zohomail.com; s=zohoarc; b=X2NmITi+T+hcQ/i8/Rb8nUXfmIL7FCMeuVfWM7ch3ER0vXZtzvTqqGYbb4Qhe7OIX/gd5Cm3CYQLEECN+cmOZSr2cXdD9SLczW976CkOE+6efMwW2MTtSH8DmTdN0KyCrVe5Txy/iw22dSnsmDmsAhM3dBAAbV2NY8myxXSd4vA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018933; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dFC09pXA9tuh88zbKA5lHFRjabbl46zk18uGxqCNxas=; b=knIz38uhDeWa+27FZdGxYCDA/W3EupFxdjqdf2gPaC75/zA9fIDggMoslSkOyNrOEtO6Xq6CvaryPizz6MXZ78wbXkic9n44UA2xTxdLozmuEbDwch8iiMMwIYtfy1Jo7TFotqMJRrRmM5SbtcV95Kk0Mut8rNPC9RSEBfeHsRw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685018933423924.1561533533293; Thu, 25 May 2023 05:48:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AOA-0000HY-2Y; Thu, 25 May 2023 08:48:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANv-0008Gh-Vj for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANs-00021C-SK for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:03 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-O7GXs3ihOX2PTvee5DScmw-1; Thu, 25 May 2023 08:47:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FC212A59541; Thu, 25 May 2023 12:47:35 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C7F47AF5; Thu, 25 May 2023 12:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dFC09pXA9tuh88zbKA5lHFRjabbl46zk18uGxqCNxas=; b=JVJOgY+EUPRQwc+KiBmuWJQLnn9RQZlBHKcgGYRITHiFl8kgk2rS9+7RWq5XTMbnGfESaW P9GNrmO25cAWdpubDhJT+UV7b8VDM+1qsKnTwhqxROfCpQ+G64xLqmQGpIT2buwEAw+AHO I4VS3JU4XjROkQKVh6hOIPcKtvhtpak= X-MC-Unique: O7GXs3ihOX2PTvee5DScmw-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 10/12] block: Fix AioContext locking in bdrv_insert_node() Date: Thu, 25 May 2023 14:47:11 +0200 Message-Id: <20230525124713.401149-11-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018934316100005 Content-Type: text/plain; charset="utf-8" While calling bdrv_new_open_driver_opts(), the main AioContext lock must be held, not the lock of the AioContext of the block subtree it will be added to afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/block.c b/block.c index e368a43761..d8cc145b77 100644 --- a/block.c +++ b/block.c @@ -5393,12 +5393,17 @@ static void bdrv_delete(BlockDriverState *bs) * empty set of options. The reference to the QDict belongs to the block l= ayer * after the call (even on failure), so if the caller intends to reuse the * dictionary, it needs to use qobject_ref() before calling bdrv_open. + * + * The caller holds the AioContext lock for @bs. It must make sure that @bs + * stays in the same AioContext, i.e. @options must not refer to nodes in a + * different AioContext. */ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, int flags, Error **errp) { ERRP_GUARD(); int ret; + AioContext *ctx =3D bdrv_get_aio_context(bs); BlockDriverState *new_node_bs =3D NULL; const char *drvname, *node_name; BlockDriver *drv; @@ -5419,8 +5424,14 @@ BlockDriverState *bdrv_insert_node(BlockDriverState = *bs, QDict *options, =20 GLOBAL_STATE_CODE(); =20 + aio_context_release(ctx); + aio_context_acquire(qemu_get_aio_context()); new_node_bs =3D bdrv_new_open_driver_opts(drv, node_name, options, fla= gs, errp); + aio_context_release(qemu_get_aio_context()); + aio_context_acquire(ctx); + assert(bdrv_get_aio_context(bs) =3D=3D ctx); + options =3D NULL; /* bdrv_new_open_driver() eats options */ if (!new_node_bs) { error_prepend(errp, "Could not create node: "); --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018986; cv=none; d=zohomail.com; s=zohoarc; b=U7Y7E/6Y8KnWvIwHPZC7kUkHLSayb91DNaT+OZddT56Hs8gIJeTaQuG6twGahH8zU0IRLPAeLE76lsOTCCa7ugg5AwdlNeNiCr2dCRVcNYxMe9Xc1mLzp02YqzMPEs89JzWvYKSypdHUx/DYhgei8SbL421TO2cLLUq2vu8650Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018986; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AG+Xf3SnB1BNii5ArZPpWmrF/fWrKCbaof1INNgsG94=; b=aIWirCADKDGenQ44u1hNw8hwSxMeah6SjzPK1+8Tq91SKqmCuQ93X4fHuBZMNok5Gq1toW3yl2O3izaqEEH706Zh3PvDjjnAuXXiO90D8C+OT5Ov5eN2ANh2NPOq3M/sxrulHWm9j75bVBVoZD0yrmo6Cv210TM1tqa7j3UFChQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16850189860791.5247766337879511; Thu, 25 May 2023 05:49:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AO5-0000B9-W0; Thu, 25 May 2023 08:48:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANx-0008Gt-3E for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANs-00022D-T5 for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:04 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-oYxeWUBMMUuM13NjTCF5EA-1; Thu, 25 May 2023 08:47:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CABB63815F60; Thu, 25 May 2023 12:47:36 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id C85E17AF5; Thu, 25 May 2023 12:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AG+Xf3SnB1BNii5ArZPpWmrF/fWrKCbaof1INNgsG94=; b=M6uoQOWz6Zex1m2AJ61rEy2o3nUOsAoTQyYb4mD8eq1SoqwWEz0pk1gf7DPYuuk2m6kzCI IW/ij5J42qsHlWcutaYXfuedcWjZe149DUo+9u/Z3JTQ6j2gmjyHc3oGPpcoHWcrPlPXLo QLYKA6SeT4OB7ZrXO5taFmvnfhqw7I8= X-MC-Unique: oYxeWUBMMUuM13NjTCF5EA-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 11/12] iotests: Make verify_virtio_scsi_pci_or_ccw() public Date: Thu, 25 May 2023 14:47:12 +0200 Message-Id: <20230525124713.401149-12-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018986575100001 Content-Type: text/plain; charset="utf-8" It has no internal callers, so its only use is being called from individual test cases. If the name starts with an underscore, it is considered private and linters warn against calling it. 256 only gets away with it currently because it's on the exception list for linters. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/iotests.py | 2 +- tests/qemu-iotests/256 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7073579a7d..ef66fbd62b 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1421,7 +1421,7 @@ def _verify_virtio_blk() -> None: if 'virtio-blk' not in out: notrun('Missing virtio-blk in QEMU binary') =20 -def _verify_virtio_scsi_pci_or_ccw() -> None: +def verify_virtio_scsi_pci_or_ccw() -> None: out =3D qemu_pipe('-M', 'none', '-device', 'help') if 'virtio-scsi-pci' not in out and 'virtio-scsi-ccw' not in out: notrun('Missing virtio-scsi-pci or virtio-scsi-ccw in QEMU binary') diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 index 13666813bd..d7e67f4a05 100755 --- a/tests/qemu-iotests/256 +++ b/tests/qemu-iotests/256 @@ -24,7 +24,7 @@ import os import iotests from iotests import log =20 -iotests._verify_virtio_scsi_pci_or_ccw() +iotests.verify_virtio_scsi_pci_or_ccw() =20 iotests.script_initialize(supported_fmts=3D['qcow2']) size =3D 64 * 1024 * 1024 --=20 2.40.1 From nobody Thu Apr 25 20:40:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685018970; cv=none; d=zohomail.com; s=zohoarc; b=KxRmnj1jbWJhdVzcEZoQdj40iedxJRNC329HPsL+EYWLUMNsxBy5bubEF2IveCZAGSwgNV9JETLxnKqZvvjdbPQlCgkeHIi4XxIIKPbgGGaVpPsOGBg7wqAEyzuq9BtHNUN+M4ttTwPd6/6SO2RC9P2AAsmuuSyw8cnPEW9FHLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685018970; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l+5eTEddy5m/B3qiIVSnDCZHfxa2jnmIFFql7WKp7Qk=; b=ZSm/leWuWMWdWN7AMvONaTAnpCBBuWwQZVp8SthOXhFZ1UUldsI+/vOwxLZdcYxV3ukTv+xFyFc3j8uuxcoSE91JhOCXOIUSsbw9gR2sSLwWKlX0SCXe3x5J4UK+ijIYOnLNJjXu3Sm4KEjqR4FZNhEt/nvHv0aYW9yhezxDKCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168501897057588.27414181523227; Thu, 25 May 2023 05:49:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2AOE-0000mL-Mz; Thu, 25 May 2023 08:48:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANu-0008Df-VH for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2ANl-00023l-C3 for qemu-devel@nongnu.org; Thu, 25 May 2023 08:48:02 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-119-Bqf8-gHuN0-6KytvLm87kQ-1; Thu, 25 May 2023 08:47:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19BB4101AA6D; Thu, 25 May 2023 12:47:38 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E3BD8162; Thu, 25 May 2023 12:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685018861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l+5eTEddy5m/B3qiIVSnDCZHfxa2jnmIFFql7WKp7Qk=; b=FSf2C9z+stiUMcesJ1Q6h9ucqkvRi5mfQ7zm8mM/g3gXq4uody642z74w41Hsqj6GHSVuX yl+s8+zm40eoW9J5fHCyzLR1l3zhNf9UAzgWv2/9iSL6fLYCt0am1eNprN90UEMQkFLhIy aJ6OIrmxAyV9TXmGBR3CfsV9txd7na8= X-MC-Unique: Bqf8-gHuN0-6KytvLm87kQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, hreitz@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org Subject: [PATCH 12/12] iotests: Test blockdev-create in iothread Date: Thu, 25 May 2023 14:47:13 +0200 Message-Id: <20230525124713.401149-13-kwolf@redhat.com> In-Reply-To: <20230525124713.401149-1-kwolf@redhat.com> References: <20230525124713.401149-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685018972514100002 Content-Type: text/plain; charset="utf-8" If blockdev-create references an existing node in an iothread (e.g. as it's 'file' child), then suddenly all of the image creation code must run in that AioContext, too. Test that this actually works. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/iothreads-create | 67 +++++++++++++++++++ tests/qemu-iotests/tests/iothreads-create.out | 4 ++ 2 files changed, 71 insertions(+) create mode 100755 tests/qemu-iotests/tests/iothreads-create create mode 100644 tests/qemu-iotests/tests/iothreads-create.out diff --git a/tests/qemu-iotests/tests/iothreads-create b/tests/qemu-iotests= /tests/iothreads-create new file mode 100755 index 0000000000..0c862d73f2 --- /dev/null +++ b/tests/qemu-iotests/tests/iothreads-create @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +# group: rw quick +# +# Copyright (C) 2023 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Creator/Owner: Kevin Wolf + +import asyncio +import iotests + +iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vdi', + 'vmdk', 'parallels']) +iotests.verify_virtio_scsi_pci_or_ccw() + +with iotests.FilePath('disk.img') as img_path, \ + iotests.VM() as vm: + + iotests.qemu_img_create('-f', 'raw', img_path, '0') + + vm.add_object('iothread,id=3Diothread0') + vm.add_blockdev(f'file,node-name=3Dimg-file,read-only=3Don,' + f'filename=3D{img_path}') + vm.add_device('virtio-scsi,iothread=3Diothread0') + vm.add_device('scsi-hd,drive=3Dimg-file,share-rw=3Don') + + vm.launch() + + iotests.log(vm.qmp( + 'blockdev-reopen', + options=3D[{ + 'driver': 'file', + 'filename': img_path, + 'node-name': 'img-file', + 'read-only': False, + }], + )) + iotests.log(vm.qmp( + 'blockdev-create', + job_id=3D'job0', + options=3D{ + 'driver': iotests.imgfmt, + 'file': 'img-file', + 'size': 1024 * 1024, + }, + )) + + # Should succeed and not time out + try: + vm.run_job('job0', wait=3D5.0) + vm.shutdown() + except asyncio.TimeoutError: + # VM may be stuck, kill it + vm.kill() + raise diff --git a/tests/qemu-iotests/tests/iothreads-create.out b/tests/qemu-iot= ests/tests/iothreads-create.out new file mode 100644 index 0000000000..5c974ff77e --- /dev/null +++ b/tests/qemu-iotests/tests/iothreads-create.out @@ -0,0 +1,4 @@ +{"return": {}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} --=20 2.40.1