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 B73D5C48BE8 for ; Sat, 12 Jun 2021 01:08:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AF7861108 for ; Sat, 12 Jun 2021 01:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbhFLBKO (ORCPT ); Fri, 11 Jun 2021 21:10:14 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:55959 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbhFLBKN (ORCPT ); Fri, 11 Jun 2021 21:10:13 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 730B7580B30; Fri, 11 Jun 2021 21:08:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 11 Jun 2021 21:08:14 -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= w6subIA/IDQ7YOvElThWfYFkjzN9b3K5fV3mF6TevK0=; b=kpaAMS/00/yF1y2+ Xp6ItdL77EInVKcl2FoC3aqscnaEoz+EsxSmTSufJCAhDDJ9ugx5F0IpMWXNQ1fb 5/r/MRs7JSo3RraT4gVaQZFJezyjyzHPMr/dgzbGJZMcquSR9SVre1huBYYbsWMY e3PE098lWjiacBkM6cvsf/s0ccMw3cXNJjl0bCOYEp0utiRTE+GVIq4GXYG/vZOY 44r9Pwj+IJbR3bPfEpXNi6zGjGg7W0GItVrrsChMxPaAjHiJd43kftQQlfTYLVGn hngmpCIjCY1gbLV9r6fd2iEYADFGTdbYey4Sz9Spf/yTGZ04x6bsefIdFKF0uA9S bLBE2g== 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=w6subIA/IDQ7YOvElThWfYFkjzN9b3K5fV3mF6Tev K0=; b=QFYeSef1BZHL724vOEIhtoXp7JYIs0D2QX7g1P2OM+u5DonAeRSXJs9NE OtPD1RZGN8dKivbHrRcRqnMHACuxroD78IzWCkyOeJ5716acY5PJjUzIGGU3q9wJ Y9ddPv/7qlt4XsFchO0BTlu1hcnvPdIOdMPLOriPPvsVS0eBMyLg5MeKu0m7YlzO fEMgOoAzQWMlq1mtU6+wcZ0VutBwVQ6li3ABjD14ib26lWIhqHunrR311GFgK0N0 qfkRqguHz4IzYr6DBmo/PK2Kt4LuO73JvUJ1ZRZ/G0iq7wlcRITdXcZgEy7/tULQ 44kLLSc80R6TFggDaZfaJrAFHLukQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduledgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkffuhffvffgjfhgtfggggfesthekredttderjeenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucggtffrrghtthgvrhhnpe fgleelkeetheelgeehueejueduhfeufffgleehgfevtdehhffhhffhtddugfefheenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnse hthhgvmhgrfidrnhgvth X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 11 Jun 2021 21:08:08 -0400 (EDT) Message-ID: 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 09:08:05 +0800 In-Reply-To: <2ee74cbed729d66a38a5c7de9c4608d02fb89f26.camel@themaw.net> References: <162322846765.361452.17051755721944717990.stgit@web.messagingengine.com> <162322862726.361452.10114120072438540655.stgit@web.messagingengine.com> <2ee74cbed729d66a38a5c7de9c4608d02fb89f26.camel@themaw.net> 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 08:43 +0800, Ian Kent wrote: > 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. But if I change to take the read lock to ensure there's no operation in progress for the revision check I would need the dget_parent(), yes? > > > > > > +               /* 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; > > > +       } >