Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2251557rdb; Mon, 9 Oct 2023 19:35:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtRasuOPfAsLHz7QGIAwPEg+yB3CdjBmqYH4N+TGExwFFIl6eqfoUqvZzsoUzNbBEztgug X-Received: by 2002:a17:90a:f406:b0:273:f887:be17 with SMTP id ch6-20020a17090af40600b00273f887be17mr16257080pjb.47.1696905345913; Mon, 09 Oct 2023 19:35:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696905345; cv=pass; d=google.com; s=arc-20160816; b=mAJJXLsfNAnrY/dbhplLYc1W2D6neJmhSyfJz+Wxa/eFsX6M3aptPDWdYtUit6FDYo 2uxa2OnEQjCMeN3nRxa00wRVEPR1k6ar7l7E+m2jq+7CQ8fNBOeBemQpxPcJm1+DW09M 0TrF2HXZ8pPMgOAbFXNhOBFIyzNrUgQjPHE8noDU19lvy/9ZeI8qlJpu3mzn5N7Fyo8D /Al6x2IUEucrxCpb8JM/cYTQ1V0sTDo3JVN45Fw8UAUXOAZsTS9G4vWd7w+EJXFo3htu 9RYqtJ8Gmua2gkMfekTq/wD9fbAOegrUYPjhFbL9nLswehphHRekmNt5RxYpqWsSkGbu GIcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1JVOiXTXOZdbi2lb57a4eTH6VFOz8zWW7VpahK0e+lI=; fh=Pzq0wC4stGh0zwNuiP25tr+2JeLSzb157Kx0i2lJJDQ=; b=I64OQV09DihiqgLycj4Xt//pJSfkffNRZMO3H4FvOrGkhL0qV5bHXYi16Xvp5x2bNa wEPqt2cuQdvfj2p88DejgTpYHbfZFQuoyIjKWEihGGDeoPpBVNP2XsGKDfcn5XNluwJf qRKpXCWB8ZEyVGucycjMSKNYu1NuXNI6fMR1NRB509dB8Ej4HkBJGagP1GhAV3M2U7S+ cZzkm1nVCR2u6BkFykoWk+tGOpr53U8v7j+92fqMdt7w2Rp+HJXXB+ioOS8TOx8HUZ0k khlomng1C4HJcBZ/plTKl6De7EcOQl+DI0Ttz37JUpqBF0LkLA04iIx02QjcF6S/XmqW YZrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@templeofstupid.com header.s=dreamhost header.b="Nokg/ZsK"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id om14-20020a17090b3a8e00b002613720fcd5si14259336pjb.35.2023.10.09.19.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 19:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@templeofstupid.com header.s=dreamhost header.b="Nokg/ZsK"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 22B4B807C85F; Mon, 9 Oct 2023 19:35:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441888AbjJJCfV (ORCPT + 99 others); Mon, 9 Oct 2023 22:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441879AbjJJCfU (ORCPT ); Mon, 9 Oct 2023 22:35:20 -0400 Received: from bee.birch.relay.mailchannels.net (bee.birch.relay.mailchannels.net [23.83.209.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A1CA9C for ; Mon, 9 Oct 2023 19:35:18 -0700 (PDT) X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 00D2D9016BA for ; Tue, 10 Oct 2023 02:35:18 +0000 (UTC) Received: from pdx1-sub0-mail-a302.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 949AB90175A for ; Tue, 10 Oct 2023 02:35:17 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1696905317; a=rsa-sha256; cv=none; b=TIBN15xECxQ2rocZAfCCJ3kLZqBDlguB7juC/JBr8XFZUp/2KyG/FuBs6DFUgETh0WlXCV kF28uchtQr221VgY6RB2cl28qvOgFnR32eNxQ5TzHvXKceCBUOnL8YJj/9re9ky64ZVsc6 88B0g3RFnTtAO/Kh3qRoZ/twIo9z4PFsUXNI3tBt8VrngB3i8nbhOyE0i3ZAGfCeFiAVc0 kBkonKB54nwhOw6wmIEhaeZJcs6V9DCfmC59qybivFa4U/q0XD6wav1Cnv7yPHPLHCWdNI rZ103BZMu1wviYxsgF9r6PAXHJ5KZMRQARxipC3u9Hj/EYBnQW2xkXPD0+pDeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1696905317; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1JVOiXTXOZdbi2lb57a4eTH6VFOz8zWW7VpahK0e+lI=; b=b3dLXMELe5+1/pcW233h03TAPrkolGfWF0iQkXxgi+/KN/sI8uefa65VKLobtyYX5Maa1L ATlcfFdUYuAKjt0FGFbyXcWAhO7/jRVDIvnxBN59rWDZDZBpwYnlf9Sbjaklrqbjz/+f1C M6HQqFx+54Ea0Y2ploqeL+Q4VDi1DbVPXalUZKsAZ9a6UC+u3mjmi0UxsIvpfEeMCAVT39 JmkCQmoe4I+iwgrdS1YJNqCppCNd7wOeP7CsreghxeWgX9fWKls5pA9zAU0eqjuHD3lDSM T3f67yHJFGmuSwe0V+0Uwdh5bhsmh0AzstkZ/j1oNdmJLW6ekbbWXOO/Iz1yjw== ARC-Authentication-Results: i=1; rspamd-7d5dc8fd68-njhvv; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@templeofstupid.com X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|kjlx@templeofstupid.com X-MailChannels-Auth-Id: dreamhost X-White-Bitter: 67d044902de176ed_1696905317826_487601250 X-MC-Loop-Signature: 1696905317826:1070752151 X-MC-Ingress-Time: 1696905317826 Received: from pdx1-sub0-mail-a302.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.126.222.25 (trex/6.9.1); Tue, 10 Oct 2023 02:35:17 +0000 Received: from kmjvbox (c-73-231-176-24.hsd1.ca.comcast.net [73.231.176.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kjlx@templeofstupid.com) by pdx1-sub0-mail-a302.dreamhost.com (Postfix) with ESMTPSA id 4S4KkY2V3pznk for ; Mon, 9 Oct 2023 19:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1696905317; bh=1JVOiXTXOZdbi2lb57a4eTH6VFOz8zWW7VpahK0e+lI=; h=Date:From:To:Cc:Subject:Content-Type; b=Nokg/ZsKA47dB1+MZhw8eHTIA0xzSOvIGoHWMdSozdnUnX+7DceMMaKgdjlAVTK1c nj54Z+kS0EpzvLFBp5hb2FlGOXiebgCK8HnvwRA8H0UknkqOtTzlCkQwKSuwK1C8BN tNVlbt/fXXvCkQRTwaH3RWb1Ys9LCpe2+NOvlm5mwbedJLjY3KL24nsA2pwML30eZZ 45cQqrAVEABS3n0FWulSbKp/olZmtNDssWAf0GKKxgcgWErMVMuTF9SEIqYptDKFL3 1QU5HbKgIjXuuHWeCHJKARrJ7qqI9Pa74O0/eyN6XDcB43HJd6YzxC2W1fqLKmtez5 50Ip4+IoewrXQ== Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e00f8 by kmjvbox (DragonFly Mail Agent v0.12); Mon, 09 Oct 2023 19:35:12 -0700 Date: Mon, 9 Oct 2023 19:35:12 -0700 From: Krister Johansen To: Bernd Schubert Cc: Krister Johansen , Miklos Szeredi , linux-fsdevel@vger.kernel.org, Miklos Szeredi , linux-kernel@vger.kernel.org, German Maglione , Greg Kurz , Max Reitz Subject: Re: [resend PATCH v2 2/2] fuse: ensure that submounts lookup their parent Message-ID: <20231010023512.GB1983@templeofstupid.com> References: <45778432fba32dce1fb1f5fd13272c89c95c3f52.1696043833.git.kjlx@templeofstupid.com> <3187f942-dcf0-4b2f-a106-0eb5d5a33949@fastmail.fm> <20231007004107.GA1967@templeofstupid.com> <968148ad-787e-4ccb-9d84-f32b5da88517@fastmail.fm> <20231009171525.GA1973@templeofstupid.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 19:35:33 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 08:43:02PM +0200, Bernd Schubert wrote: > On 10/9/23 19:15, Krister Johansen wrote: > > Thanks, I had forgotten that d_make_root() would call iput() for me if > > d_alloc_anon() fails. Let me restate this to suggest that I account the > > nlookup to the parent if fuse_dentry_revalidate_lookup() or fuse_iget() > > fail instead. Does that sound right? > > Hmm, so server/daemon side uses the lookup count to have an inode reference > - are you sure that parent is the right inode for the forget call? And what > is the probability for such failures? I.e. is that performance critical? > Wouldn't be much simpler and clearer to just avoid and doubt and to send an > immediate forget? Yeah, the server / daemon side need to track the lookup count so that it knows when it can close the fd for the file on the server-side. (At least for virtiofsd, anyway.). The reason I had avoided doing the forget in the submount code is that it needs a forget linkage in order to call fuse_queue_forget(). One of these is allocated by fuse_alloc_inode(). A well formed parent should always have one. However, if the fuse_iget() for the submount root fails, then there's no linkage to borrow from the new inode. The code could always call fuse_alloc_forget() directly, like is done elsewhere. I thought it might be hard to get the memory for this allocation if fuse_iget() also can't allocate enough, but I could move the allocation earlier in the function and just free it if it's not used. I'm not confident that would reduce the amount of code in the function, but if you'd find it clearer, I'm happy to modify it accordingly. -K