Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1297658rdb; Fri, 20 Oct 2023 14:34:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjW/Gq+zdLa1DDjM3iioWzquPhgwtFxzgVBfvrbYCJX2T9M37eFt5q+ARXULZEMZT1+JcJ X-Received: by 2002:ad4:4ea7:0:b0:63d:3bea:f663 with SMTP id ed7-20020ad44ea7000000b0063d3beaf663mr3720136qvb.47.1697837672454; Fri, 20 Oct 2023 14:34:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697837672; cv=pass; d=google.com; s=arc-20160816; b=06+KjPX+O4s//FAV8LI+JWeP9g9WVK0FUsM7prhw0U7geUB3P3BAl0YTXJ938nXHc3 LK0+PI9/rSpvfe4dbzzx9bHewjVruA/gBd2QAq76OXWjOyHqMXBWKyuvW434Z5Ap/Vk7 pyM3jcCTD1W78/aRzZjY+w1JjDwZ/TwK6CacfpXfwU0rgaNkdmQ42RSKmI162IKUcx8v spWkKGlh/pxsyT0fCEP81qGQypEFZCXZJiVEopzPsJKTEFVZXPvXFE9t6jBWSBTXlJkq QAuM6O4WB+AGxEOnh/mloNHP0ZZCf2F0o7fF6R7jxbzzl09YYamvI/QS8iVFrhxvg+9J u1ng== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tAOkwi0YuJDJdJg4hvrE80c/LLCeFBLsZA85g0a3bLA=; fh=nURpkyv+M+PSivyOeK6E1jA0x5xzYPf6HCfAiri4tU8=; b=HqyE6Jy2RykrTu1jN2Vo8/CDCCMuM0m+lT6ophMCxt2ybVVE4z0WVodhydSI8shi1M xNdal03UWXhdl92fOjz0/UNu+XgA3j8SGlZi7SwC82NsUwlQhp/j86d3Vx+Ji+GIWvSD qcjgvkLOjPBATsHw4QlCazrwerZK/DPmsJP0/Kq5s7tqWfhbA7ejlOXlJL2Bd/DGc6XB 0ooPR9n4J9Z9JJ1WlWu8H2ByV74H0IzQC1TN0K7cWgQDyqBnONAP1G/VO0iLKGzT7oUU X7zaSEx//xSu+naoUceENef3JCYZENqZu22Dva06PmWWrEM7tKiz2uLLk5M6G37LTpLF vYsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@templeofstupid.com header.s=dreamhost header.b=OVTFOlQs; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k6-20020a0cfa46000000b0066cf5fda809si2063114qvo.316.2023.10.20.14.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 14:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@templeofstupid.com header.s=dreamhost header.b=OVTFOlQs; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 489A3832FDAE; Fri, 20 Oct 2023 14:34:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233097AbjJTVeK (ORCPT + 99 others); Fri, 20 Oct 2023 17:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232838AbjJTVeJ (ORCPT ); Fri, 20 Oct 2023 17:34:09 -0400 Received: from snail.cherry.relay.mailchannels.net (snail.cherry.relay.mailchannels.net [23.83.223.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E340710C8 for ; Fri, 20 Oct 2023 14:33:43 -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 4C2FBC1F4F for ; Fri, 20 Oct 2023 21:33:43 +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 0E3C8C0183 for ; Fri, 20 Oct 2023 21:33:43 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1697837623; a=rsa-sha256; cv=none; b=ct4ZZjc0Tx3LsEGXxhCGKeIc0s9Rn6I5mutTKpMlvZoGRzyB09mrFt6zIG/UNmA/hGi2iy hfABJYXY3+GJyy4XU6pZ8tM0YSejFiCSA0Tfb+l0VQUuEdCaM3hmuVeFPV/sBrMISNg2hB TLV8YjalSQOsFbTr1zMU+k1t1Rv8bqJQHQdqx05UC85Jcc2/HDe4FeeU/UGtr8eZgPr2ak MhZAgfj4rhMPlEegVSZ3ENf9cujVqIiFxk8D0uHbaBy9CftF0E9ZCCJFvY+1MauhKAyl2D dZKvOii4cvVTU7WZBuDw6rIU30DrpZXIg2TKynHVVYtAqUDh9vXEXT8XP0ZTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1697837623; 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:dkim-signature; bh=tAOkwi0YuJDJdJg4hvrE80c/LLCeFBLsZA85g0a3bLA=; b=SRujAP9vadYdq7MgyZayfUP64FwN0oN9IVpm26KVpb9tfDaSD8kqeypaNGb4UE86mBYihl 7yD1+yFh2kHGb12V+MoxUdITcCDqdEE7BlhfW02xxN3/NZrSLj5cI5ZJZhJ5oGPDnyvMtI oyhj8WLtFzHzlI548d9Dg1nmZxLjzRliWchFcZPZnOaGdDR/kvs4eFXeZllvqy5l5h6OBv 8UAe01jvbbYgFm6BwI2YKbxn6BRgOd2ifc0Rt20plkN/bzvExnRY0Ub+qZ69+99TKvaFkM 5lvbm9YGIIeKSQiifJ8HkjtezzKhK0a0FKBchjVOQQei6lwVbhifxcjqvLnSTQ== ARC-Authentication-Results: i=1; rspamd-846f4b758b-sm9qj; 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-Turn-Bottle: 79efae1560261831_1697837623136_1612333314 X-MC-Loop-Signature: 1697837623136:4101853044 X-MC-Ingress-Time: 1697837623136 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.117.92.249 (trex/6.9.2); Fri, 20 Oct 2023 21:33:43 +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 4SByWV27q5zLZ for ; Fri, 20 Oct 2023 14:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1697837622; bh=tAOkwi0YuJDJdJg4hvrE80c/LLCeFBLsZA85g0a3bLA=; h=Date:From:To:Cc:Subject:Content-Type:Content-Transfer-Encoding; b=OVTFOlQsgFzLIiYCpoMztlhv5iEGoTEcT7Lt7DWIRHnOU8uD2iWm04tPLH/OzVvCN izKzWEFvYdGenUkwdWKLqGhEIj6IqbY7RoEacAruLnnDD1JKIEP4MHkTLyjiIujg5t nttA6wTOM2WNnPo9r7DU8J3cKRKhlbiaUoPomPUciNUkofYm3eupQRP/gFCGp+bvg4 ia6cFCvZNhaZgsAEeJbEG2WxTqC41zJ9bJrumYGd90NNKcyeoqDPF73jnj6nYtmFyO VMqetFb2pN1Lmdh06k+6x03loxDU5GU6eiA4zTIULqvK8WS5PWynuHi3xzmW+hT4Uf Gm8RAD+ulz4kA== Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e0042 by kmjvbox (DragonFly Mail Agent v0.12); Fri, 20 Oct 2023 14:33:37 -0700 Date: Fri, 20 Oct 2023 14:33:37 -0700 From: Krister Johansen To: Miklos Szeredi Cc: Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, German Maglione , Greg Kurz , Max Reitz , Bernd Schubert Subject: Re: [PATCH v3] fuse: share lookup state between submount and its parent Message-ID: <20231020213337.GA2113@templeofstupid.com> References: <20231018013359.GB3902@templeofstupid.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 20 Oct 2023 14:34:27 -0700 (PDT) Hi Miklos, Thanks for all the feedback. I've made all the changes you requested and was pleased to find that this reduced the overall size of the patch. On Thu, Oct 19, 2023 at 02:39:34PM +0200, Miklos Szeredi wrote: > On Wed, Oct 18, 2023 at 3:34 AM Krister Johansen > wrote: > > > > Fuse submounts do not perform a lookup for the nodeid that they inherit > > from their parent. Instead, the code decrements the nlookup on the > > submount's fuse_inode when it is instantiated, and no forget is > > performed when a submount root is evicted. > > > > Trouble arises when the submount's parent is evicted despite the > > submount itself being in use. In this author's case, the submount was > > in a container and deatched from the initial mount namespace via a > > MNT_DEATCH operation. When memory pressure triggered the shrinker, the > > inode from the parent was evicted, which triggered enough forgets to > > render the submount's nodeid invalid. > > > > Since submounts should still function, even if their parent goes away, > > solve this problem by sharing refcounted state between the parent and > > its submount. When all of the references on this shared state reach > > zero, it's safe to forget the final lookup of the fuse nodeid. > > > > Signed-off-by: Krister Johansen > > Cc: stable@vger.kernel.org > > Fixes: 1866d779d5d2 ("fuse: Allow fuse_fill_super_common() for submounts") > > --- > > fs/fuse/fuse_i.h | 20 +++++++++++ > > fs/fuse/inode.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++-- > > 2 files changed, 105 insertions(+), 3 deletions(-) > > > > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h > > index 405252bb51f2..0d1659c5016b 100644 > > --- a/fs/fuse/fuse_i.h > > +++ b/fs/fuse/fuse_i.h > > @@ -63,6 +63,24 @@ struct fuse_forget_link { > > struct fuse_forget_link *next; > > }; > > > > +/* Submount lookup tracking */ > > +struct fuse_submount_lookup { > > + /** Refcount */ > > + refcount_t count; > > + > > + /** Unique ID, which identifies the inode between userspace > > + * and kernel */ > > + u64 nodeid; > > + > > + /** Number of lookups on this inode */ > > + u64 nlookup; > > sl->nlookup will always be one. So that can just be implicit and this > field can just go away. > > > + > > + /** The request used for sending the FORGET message */ > > + struct fuse_forget_link *forget; > > + > > + struct rcu_head rcu; > > RCU would be needed if any fields could be accessed from RCU protected > code. But AFAICS there's no such access, so this shouldn't be needed. > Am I missing something? No, you're correct and not missing anything. I've cleaned this up. Thanks again, -K