Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp999608pxj; Fri, 11 Jun 2021 18:11:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoaCMmhlRBmMvRuzjy/Wr/VGEkIfp/UCGSbRGOJd/INX1w+AEJKpJva0ezN4F5TwmSWKyj X-Received: by 2002:a17:906:3884:: with SMTP id q4mr6062923ejd.66.1623460298093; Fri, 11 Jun 2021 18:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623460298; cv=none; d=google.com; s=arc-20160816; b=aVCZjFPESMboYenNusGtH0F9gEHloab/N5acpfv/s2YTAEuoB/GKcZ2qq+y4GAffPm ZyVXSyfT0v4T4P9qttAQmmbSZyQWm00uKQ89gaPcUBPrSyORKHgtx1O9FAlkB6BYJDBP sIa96xjx81ve5n3HKqOhapx8mce6zptbO+upv3sE3mgLIADn0/kdcMArPSQ7ZCDoMDk8 Mz6oZuOG4NsmlJfC09Wnz4xOAm8ck1CCpBOM0Jr7IpsTMbgfMXCIB2QK8FvrKJUp+FHN X22NmvNfmvOWV0bh3pu8GpesVRU1YGvOGtUhUlXoe0lQlcvDQdmLls0Gd9BVS8HgxBKB FzfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature:dkim-signature; bh=w6subIA/IDQ7YOvElThWfYFkjzN9b3K5fV3mF6TevK0=; b=yGvi1JRzrO5uh5T11V+EHG38hDNCA27XhFRQBwwkmaRzJCZ9orgPTeWnIzL3xdvHS9 psY5cnUiuNPigR7KeuhX+6+JiXHNCBHzHK9SpKBpiaYkNJ9ouOjEKs3vOAytI9WiCbQ0 kUt8mNiN1mx4dq6TfGo7cMXILfHK80iTJRcTji6P+nPWB0GoLmDLgNf07sVIpnXg17ku v0o+2D0mL0k/ED3iLXOfs/DPYP604M27jxMl0ZT2SHklRKmJiB7yWWmDD2FnLSI4mD5x fI6LN8SFeGi2XkV2cvbiDDSGDGCe3Xspt/5dvnvCO8g9dfMSCuQyQXcmt82g+ezBEoYT KeQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm3 header.b="kpaAMS/0"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QFYeSef1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si6473992edr.451.2021.06.11.18.11.15; Fri, 11 Jun 2021 18:11:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@themaw.net header.s=fm3 header.b="kpaAMS/0"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QFYeSef1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230051AbhFLBKN (ORCPT + 99 others); Fri, 11 Jun 2021 21:10:13 -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; > > > +       } >