From patchwork Wed Apr 19 17:28:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 13217195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5019AC77B78 for ; Wed, 19 Apr 2023 17:29:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.523644.813919 (Exim 4.92) (envelope-from ) id 1ppBbl-0002rN-HL; Wed, 19 Apr 2023 17:28:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 523644.813919; Wed, 19 Apr 2023 17:28:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ppBbl-0002rA-D0; Wed, 19 Apr 2023 17:28:41 +0000 Received: by outflank-mailman (input) for mailman id 523644; Wed, 19 Apr 2023 17:28:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ppBbk-0001ia-Fs for xen-devel@lists.xenproject.org; Wed, 19 Apr 2023 17:28:40 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9f49f692-ded7-11ed-b21f-6b7b168915f2; Wed, 19 Apr 2023 19:28:40 +0200 (CEST) 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-178-QXXZW6VEOQuQZxBq_W3LMA-1; Wed, 19 Apr 2023 13:28:32 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E9D802823810; Wed, 19 Apr 2023 17:28:30 +0000 (UTC) Received: from localhost (unknown [10.39.192.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5495F2166B33; Wed, 19 Apr 2023 17:28:30 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9f49f692-ded7-11ed-b21f-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681925318; 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=cpef4kT6gqf7n/rR0/ynntTmCBLqt8QRSEC7iM5/ics=; b=Gj6JkrpS82YHcn37K3ZEmocqzGqkD3zrNgIxXNj+0sB3sBh53Zp3l8EvES1VVrz3CY4IWV KvTOfpbRICb++cmuJfEIWLQ4csRiUVOktAjTo7MakOILzRRYGruIUXAKL2RCfrYHPdMm3O pshpmkeniLnTV34rAt204jArzf/n3TI= X-MC-Unique: QXXZW6VEOQuQZxBq_W3LMA-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Stefano Stabellini , Marcel Apfelbaum , Fam Zheng , Stefan Hajnoczi , Julia Suvorova , Hanna Reitz , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , Coiby Xu , Paul Durrant , Ronnie Sahlberg , Eduardo Habkost , Juan Quintela , "Michael S. Tsirkin" , Stefano Garzarella , Anthony Perard , Kevin Wolf , "Richard W.M. Jones" , Richard Henderson , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, "Dr. David Alan Gilbert" , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Peter Lieven , eesposit@redhat.com, Aarushi Mehta , Stefan Weil , Xie Yongji , David Woodhouse Subject: [PATCH v2 04/16] block/export: only acquire AioContext once for vhost_user_server_stop() Date: Wed, 19 Apr 2023 13:28:05 -0400 Message-Id: <20230419172817.272758-5-stefanha@redhat.com> In-Reply-To: <20230419172817.272758-1-stefanha@redhat.com> References: <20230419172817.272758-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 vhost_user_server_stop() uses AIO_WAIT_WHILE(). AIO_WAIT_WHILE() requires that AioContext is only acquired once. Since blk_exp_request_shutdown() already acquires the AioContext it shouldn't be acquired again in vhost_user_server_stop(). Signed-off-by: Stefan Hajnoczi --- util/vhost-user-server.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index 40f36ea214..5b6216069c 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -346,10 +346,9 @@ static void vu_accept(QIONetListener *listener, QIOChannelSocket *sioc, aio_context_release(server->ctx); } +/* server->ctx acquired by caller */ void vhost_user_server_stop(VuServer *server) { - aio_context_acquire(server->ctx); - qemu_bh_delete(server->restart_listener_bh); server->restart_listener_bh = NULL; @@ -366,8 +365,6 @@ void vhost_user_server_stop(VuServer *server) AIO_WAIT_WHILE(server->ctx, server->co_trip); } - aio_context_release(server->ctx); - if (server->listener) { qio_net_listener_disconnect(server->listener); object_unref(OBJECT(server->listener));