From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE32C48BE5 for ; Sat, 12 Jun 2021 00:43:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D66061181 for ; Sat, 12 Jun 2021 00:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbhFLApX (ORCPT ); Fri, 11 Jun 2021 20:45:23 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:56769 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbhFLApW (ORCPT ); Fri, 11 Jun 2021 20:45:22 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 4AED0580932; Fri, 11 Jun 2021 20:43:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 11 Jun 2021 20:43:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h= message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; s=fm3; bh= FxEV9iata6R86LklafTZvkJMZtuSkpOtZknlBZ5CHkc=; b=rrFAnW00dEQ00Mg6 AkIrxeBA63am+tsme2lHFhTchg7ZTuO0VBjVWuQ2yVoAFGvaBzUOwLsbCsi6kPtI KySqME5ycW1V5nS4hznOZJTO3n1+UwpIWT/SzEEuW10qXt/C7OmXICBB1Dv239Wo wuwolmaNbbbpnHLZggEOu/OdxnCZpCFWLLY4jhTtCMz99TfD7nxDjJhn1ehUf00d npy5Dd3RTU55o9rsTsuaUakK//AgVhM9BFQCowfmNtVwqXzqaBy5VIp/LzYOvlPW IMsce+ePeKEt7FiVpjxfNyxFQQvWmQQ40kRhPoyBk4Iyyzgd5hnzp3KsFmXwLTS4 FrlBrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=FxEV9iata6R86LklafTZvkJMZtuSkpOtZknlBZ5CH kc=; b=USsl5TdGjX14fRPAXNWPO+81QkDcJbdV65io9DbEBomP2PwVC5Q25ke6I CwAH1Cd7nvP3Rf4MUZbd0pdLv8Z8OZRUWgXI+6YVIuo70bSG7o0zUD1EfVdcIqcS kmNVL5ja3TCoYz1Rt4iLrqYvn5b5TU14wGIBFM0NmNhPQ671Z5Znx6A2ifxID+U+ l0+aD4xWYqT6Z+vfQj+4IdGEi/8EEaTBiH740zcp3sbGAriTcvEVJVohxdQFQGU3 bONj3E4TEp2BKLyj1YeicFNhDSwHCT3NDSjfR9/jHVtJuzUj51cDNa3T+XN40Hlo gQSSzt8zjsmxY+IHfxOw50LmJ06yg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduledgvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkffuhffvffgjfhgtfggggfesthekredttderjeenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucggtffrrghtthgvrhhnpe fgleelkeetheelgeehueejueduhfeufffgleehgfevtdehhffhhffhtddugfefheenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnse hthhgvmhgrfidrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 11 Jun 2021 20:43:17 -0400 (EDT) Message-ID: <2ee74cbed729d66a38a5c7de9c4608d02fb89f26.camel@themaw.net> Subject: Re: [PATCH v6 3/7] kernfs: use VFS negative dentry caching From: Ian Kent To: Al Viro Cc: Greg Kroah-Hartman , Tejun Heo , Eric Sandeen , Fox Chen , Brice Goglin , Rick Lindsley , David Howells , Miklos Szeredi , Marcelo Tosatti , "Eric W. Biederman" , Carlos Maiolino , linux-fsdevel , Kernel Mailing List Date: Sat, 12 Jun 2021 08:43:13 +0800 In-Reply-To: References: <162322846765.361452.17051755721944717990.stgit@web.messagingengine.com> <162322862726.361452.10114120072438540655.stgit@web.messagingengine.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2021-06-12 at 00:07 +0000, Al Viro wrote: > On Wed, Jun 09, 2021 at 04:50:27PM +0800, Ian Kent wrote: > > > +       if (d_really_is_negative(dentry)) { > > +               struct dentry *d_parent = dget_parent(dentry); > > +               struct kernfs_node *parent; > > What the hell is dget_parent() for?  You don't do anything blocking > here, so why not simply grab dentry->d_lock - that'll stabilize > the value of ->d_parent just fine.  Just don't forget to drop the > lock before returning and that's it... Thanks Al, I'll change it. > > > +               /* If the kernfs parent node has changed discard > > and > > +                * proceed to ->lookup. > > +                */ > > +               parent = kernfs_dentry_node(d_parent); > > +               if (parent) { > > +                       if (kernfs_dir_changed(parent, dentry)) { > > +                               dput(d_parent); > > +                               return 0; > > +                       } > > +               } > > +               dput(d_parent); > > + > > +               /* The kernfs node doesn't exist, leave the dentry > > +                * negative and return success. > > +                */ > > +               return 1; > > +       }