From patchwork Mon Apr 3 18:30:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 13198573 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 A981AC76196 for ; Mon, 3 Apr 2023 18:34:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.517570.803159 (Exim 4.92) (envelope-from ) id 1pjP0B-00039i-Ht; Mon, 03 Apr 2023 18:33:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 517570.803159; Mon, 03 Apr 2023 18:33:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjP0B-00039Z-F2; Mon, 03 Apr 2023 18:33:59 +0000 Received: by outflank-mailman (input) for mailman id 517570; Mon, 03 Apr 2023 18:33:58 +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 1pjP0A-00038w-HI for xen-devel@lists.xenproject.org; Mon, 03 Apr 2023 18:33:58 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 177b4932-d24e-11ed-85db-49a42c6b2330; Mon, 03 Apr 2023 20:33:57 +0200 (CEST) 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-117-j26lxWggN_O159O5n3-PNg-1; Mon, 03 Apr 2023 14:33:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3118C885620; Mon, 3 Apr 2023 18:30:37 +0000 (UTC) Received: from localhost (unknown [10.39.192.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71C5440C6EC4; Mon, 3 Apr 2023 18:30:36 +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: 177b4932-d24e-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680546835; 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=hLGTNhZNr3bIXX7Mx11PRwkKdI3CfrxoXkyIIe5WNhM=; b=ex87W1Y2rVLKmb4iIysD6LEcc+IrdiGRxrTImhC5fU5oW9/2y581T4DsPBNiyueuHpq6Li KvpiWb1NsWVBioKxv5i5yW33Gr+3vluq1C0jFv+BtC47HIMa2tHZ8b7xBF/Xxgoln6O/HC rqYr6PiZ0kz3vdcKaxMIeQmHDHs1W8c= X-MC-Unique: j26lxWggN_O159O5n3-PNg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Julia Suvorova , Stefan Hajnoczi , Kevin Wolf , Peter Lieven , Coiby Xu , xen-devel@lists.xenproject.org, Richard Henderson , Stefano Garzarella , , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Paul Durrant , "Richard W.M. Jones" , "Dr. David Alan Gilbert" , Marcel Apfelbaum , Aarushi Mehta , Stefano Stabellini , Fam Zheng , David Woodhouse , Stefan Weil , Juan Quintela , Xie Yongji , Hanna Reitz , Ronnie Sahlberg , eesposit@redhat.com, "Michael S. Tsirkin" , =?utf-8?q?Danie?= =?utf-8?q?l_P=2E_Berrang=C3=A9?= , Anthony Perard Subject: [PATCH 11/13] block/fuse: take AioContext lock around blk_exp_ref/unref() Date: Mon, 3 Apr 2023 14:30:02 -0400 Message-Id: <20230403183004.347205-12-stefanha@redhat.com> In-Reply-To: <20230403183004.347205-1-stefanha@redhat.com> References: <20230403183004.347205-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 These functions must be called with the AioContext acquired: /* Callers must hold exp->ctx lock */ void blk_exp_ref(BlockExport *exp) ... /* Callers must hold exp->ctx lock */ void blk_exp_unref(BlockExport *exp) Signed-off-by: Stefan Hajnoczi --- block/export/fuse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/export/fuse.c b/block/export/fuse.c index 06fa41079e..18394f9e07 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -244,7 +244,9 @@ static void read_from_fuse_export(void *opaque) FuseExport *exp = opaque; int ret; + aio_context_acquire(exp->common.ctx); blk_exp_ref(&exp->common); + aio_context_release(exp->common.ctx); do { ret = fuse_session_receive_buf(exp->fuse_session, &exp->fuse_buf); @@ -256,7 +258,9 @@ static void read_from_fuse_export(void *opaque) fuse_session_process_buf(exp->fuse_session, &exp->fuse_buf); out: + aio_context_acquire(exp->common.ctx); blk_exp_unref(&exp->common); + aio_context_release(exp->common.ctx); } static void fuse_export_shutdown(BlockExport *blk_exp)