From nobody Sat Apr 11 23:03:18 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773068996; cv=none; d=zohomail.com; s=zohoarc; b=BcZpyMCeDsT7uEGgwEfd9Qx8TLzNNdwRzIHn8l31e78CJL7hIn/gpLDXiOiN1L/RGpxtHkbrdgsYeI1KIRJJXm2N1r54bjfZZE8TQUBybY5rRzaaVfE+ofcOzmlO/kBHhdaviMJKQmdKnv1EmBe1txXiqeCGbelRCS1ab7pd4sA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773068996; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BOixUczgf/re8Xp6Djr53L45pCSu7AEC5w4EK2f/CNY=; b=K/NOAhtBbcop3vK41eEFC9XhmKIWhMAQHR73Oom/NiTJLosRxUhtIU/CR9/uHdp1JsUgmrqAJNAvR1Ivr5HT9jC0HoPbByiiuCvc5f3ZFJGE/qPjfnWNm2YWbmw3H3IPE7eaZgSaO/edviWC5rl87poSjWgpx6GswxAlReHnmas= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773068996818531.4184127698916; Mon, 9 Mar 2026 08:09:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vzcEW-0000jH-Q5; Mon, 09 Mar 2026 11:09: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 1vzcEV-0000iQ-70 for qemu-devel@nongnu.org; Mon, 09 Mar 2026 11:09:23 -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 1vzcET-0008Kb-LF for qemu-devel@nongnu.org; Mon, 09 Mar 2026 11:09:22 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-yjC4y0fyNcmh6QQ4iHLgdQ-1; Mon, 09 Mar 2026 11:09:19 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4836abfc742so100207075e9.0 for ; Mon, 09 Mar 2026 08:09:19 -0700 (PDT) Received: from localhost (p200300cfd737d0cf29d515fbd6051d53.dip0.t-ipconnect.de. [2003:cf:d737:d0cf:29d5:15fb:d605:1d53]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b7547sm287648645e9.12.2026.03.09.08.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 08:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773068961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BOixUczgf/re8Xp6Djr53L45pCSu7AEC5w4EK2f/CNY=; b=IL/NiesQolOZsmjsU/zNXLPbzYT5ocUA+/m0VHpRXrMVlA5zbTTPtAwVJ2iGFCdpSIM7VZ lf+1lRISiElCeLwgxOYLXA2mtCleJtOiqmnOtHrrZg/GYKtSO4g1oij1S393Dak0pwbRbd BVfiRF8PcXUIhPjlTR6QSALa51ORfvU= X-MC-Unique: yjC4y0fyNcmh6QQ4iHLgdQ-1 X-Mimecast-MFC-AGG-ID: yjC4y0fyNcmh6QQ4iHLgdQ_1773068959 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773068958; x=1773673758; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BOixUczgf/re8Xp6Djr53L45pCSu7AEC5w4EK2f/CNY=; b=EE8M+llhI2zbYOtXeKkAif2wwRUKk1aL+TcSKjNVhg7yd29Ojtc/FGonS8cHwiRTf5 fSwBMrKqm8Kal/Yd1O3zZJjfTCVtspQVenx1y5BAY7fj7dI8QdQJcp9Bg68l1Gb5KQDY YiN0q+8TYNfPJeK13buQ6jaTsl9CY41WBkbp/PFZURrK4VRu3lWfwVCq8rXAGf+trmZ3 fvzvC7qTLx9RNuXPbUr5ucsNvdVKEdQVYB1ANcCmMUFItKYtiw7JiZxTpOPzQRJTkoED 1RhUM/d4QurT+b4xVLU20CxaAYHtrq6QjIpFsj3peJrburCE+sfpXbbwwQFO6J/CDyBa xMaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773068958; x=1773673758; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BOixUczgf/re8Xp6Djr53L45pCSu7AEC5w4EK2f/CNY=; b=u+0D8tr8Mxik/OsCeNj5LjyHqmpe6fotbgtmxpLXoGC/7RpdWuuN8eW4FGXyCT49SU hTXatMeSLxzoO5Qi2qJ2mYGt8WJYWUVXet+NiuKVtqZkwVRWw5dhUmHQ9uJe+2pAqdCr ltv7SWYun3S3bEbPUXFFQ1+DKLN2EDwYaSip219jb/ttmdHK3HUGod2vTZN6UbEK+1mJ 6ay8jJ+jw4RY5to5g1niLCjoNqJ93DgKjSTz+xj14N2/1PURCDWWLxATTGhhERT0J3vG eKOJmR3TqrvuZIopcdAW5e0ipMp/ro0j8oap3nyqYwqP4dyXW7dxOsQH49FnD1CITUER Di2g== X-Gm-Message-State: AOJu0YxHxH+h2UpZmN64ErqDe3vNme0Dpv1JtEPo8G2uDPnSpPahUHda YqxUfC3xxUr5ja1+HAzk+NsEPXLFS/qdfhQnvpztGrWjqy49miORUxIuFP1sG32I4fdi7teHhuE WwRTlyllMrW6IVXdGdI0HGR5S/dtQ6LBAugcK4ZNBmF9pl/6xYjXz9F5H X-Gm-Gg: ATEYQzxutyH6m+t2z17Wce5MR3kiTnbDWDA2LZ8lWh9GDJwZ7VxzNAtQM6NXZRe5PW5 Nqrn2F/Y6PJFBIo0SGj/QFLg5iGqZ77+/LiNy7fdmvUsdB15fjt78WRrrHU9L9jw5pBIIkMh+Wj h+S1aa+PcVa2hrFiDs5oCfTOD0meO6xWWc2hGFhudgazA80qBGRMfqwiUFdQh093s+pnjAVd8Hk A7N99W/jSr2YXogrTdH9VqYHq49evH2bj9QKzB1FVmDSewCK+OcW7yB4Szj+vrN9UXy66gUqkje zRhN4H75D4VpStuGUTmKEavMIfZj7r9rzBM6lBaQ+q0faBWlH3aix82a5fkWToWrR43dS4Yu7eS FgoMhfZIWOzPTY39ITSnYMbxfll90gM8+qKbqzRzbWYdX7yo93L1cnFjssLqqnSBKv74b1+VLQk KT/y2n X-Received: by 2002:a05:600c:3114:b0:485:40c6:f516 with SMTP id 5b1f17b1804b1-48540c6f648mr18378885e9.33.1773068958360; Mon, 09 Mar 2026 08:09:18 -0700 (PDT) X-Received: by 2002:a05:600c:3114:b0:485:40c6:f516 with SMTP id 5b1f17b1804b1-48540c6f648mr18378305e9.33.1773068957923; Mon, 09 Mar 2026 08:09:17 -0700 (PDT) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , Brian Song Subject: [PATCH v5 05/25] fuse: Change setup_... to mount_fuse_export() Date: Mon, 9 Mar 2026 16:08:36 +0100 Message-ID: <20260309150856.26800-6-hreitz@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260309150856.26800-1-hreitz@redhat.com> References: <20260309150856.26800-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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: 1773068998639154100 Content-Type: text/plain; charset="utf-8" There is no clear separation between what should go into setup_fuse_export() and what should stay in fuse_export_create(). Make it clear that setup_fuse_export() is for mounting only. Rename it, and move everything that has nothing to do with mounting up into fuse_export_create(). Reviewed-by: Stefan Hajnoczi Signed-off-by: Hanna Czenczek --- block/export/fuse.c | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/block/export/fuse.c b/block/export/fuse.c index a56f645c05..00bb2ffee4 100644 --- a/block/export/fuse.c +++ b/block/export/fuse.c @@ -72,8 +72,7 @@ static void fuse_export_delete(BlockExport *exp); =20 static void init_exports_table(void); =20 -static int setup_fuse_export(FuseExport *exp, const char *mountpoint, - bool allow_other, Error **errp); +static int mount_fuse_export(FuseExport *exp, Error **errp); static void read_from_fuse_export(void *opaque); =20 static bool is_regular_file(const char *path, Error **errp); @@ -193,23 +192,32 @@ static int fuse_export_create(BlockExport *blk_exp, exp->st_gid =3D getgid(); =20 if (args->allow_other =3D=3D FUSE_EXPORT_ALLOW_OTHER_AUTO) { - /* Ignore errors on our first attempt */ - ret =3D setup_fuse_export(exp, args->mountpoint, true, NULL); - exp->allow_other =3D ret =3D=3D 0; + /* Try allow_other =3D=3D true first, ignore errors */ + exp->allow_other =3D true; + ret =3D mount_fuse_export(exp, NULL); if (ret < 0) { - ret =3D setup_fuse_export(exp, args->mountpoint, false, errp); + exp->allow_other =3D false; + ret =3D mount_fuse_export(exp, errp); } } else { exp->allow_other =3D args->allow_other =3D=3D FUSE_EXPORT_ALLOW_OT= HER_ON; - ret =3D setup_fuse_export(exp, args->mountpoint, exp->allow_other,= errp); + ret =3D mount_fuse_export(exp, errp); } if (ret < 0) { goto fail; } =20 + g_hash_table_insert(exports, g_strdup(exp->mountpoint), NULL); + + aio_set_fd_handler(exp->common.ctx, + fuse_session_fd(exp->fuse_session), + read_from_fuse_export, NULL, NULL, NULL, exp); + exp->fd_handler_set_up =3D true; + return 0; =20 fail: + fuse_export_shutdown(blk_exp); fuse_export_delete(blk_exp); return ret; } @@ -227,10 +235,10 @@ static void init_exports_table(void) } =20 /** - * Create exp->fuse_session and mount it. + * Create exp->fuse_session and mount it. Expects exp->mountpoint, + * exp->writable, and exp->allow_other to be set as intended for the mount. */ -static int setup_fuse_export(FuseExport *exp, const char *mountpoint, - bool allow_other, Error **errp) +static int mount_fuse_export(FuseExport *exp, Error **errp) { const char *fuse_argv[4]; char *mount_opts; @@ -243,7 +251,7 @@ static int setup_fuse_export(FuseExport *exp, const cha= r *mountpoint, */ mount_opts =3D g_strdup_printf("max_read=3D%zu,default_permissions%s", FUSE_MAX_BOUNCE_BYTES, - allow_other ? ",allow_other" : ""); + exp->allow_other ? ",allow_other" : ""); =20 fuse_argv[0] =3D ""; /* Dummy program name */ fuse_argv[1] =3D "-o"; @@ -256,30 +264,17 @@ static int setup_fuse_export(FuseExport *exp, const c= har *mountpoint, g_free(mount_opts); if (!exp->fuse_session) { error_setg(errp, "Failed to set up FUSE session"); - ret =3D -EIO; - goto fail; + return -EIO; } =20 - ret =3D fuse_session_mount(exp->fuse_session, mountpoint); + ret =3D fuse_session_mount(exp->fuse_session, exp->mountpoint); if (ret < 0) { error_setg(errp, "Failed to mount FUSE session to export"); - ret =3D -EIO; - goto fail; + return -EIO; } exp->mounted =3D true; =20 - g_hash_table_insert(exports, g_strdup(mountpoint), NULL); - - aio_set_fd_handler(exp->common.ctx, - fuse_session_fd(exp->fuse_session), - read_from_fuse_export, NULL, NULL, NULL, exp); - exp->fd_handler_set_up =3D true; - return 0; - -fail: - fuse_export_shutdown(&exp->common); - return ret; } =20 /** --=20 2.53.0