Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp987353pxj; Fri, 11 Jun 2021 17:44:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyWDBAzKRT1pT3+OQ8MpjfSnQK0LcBNI2PcDPmysyv9bXWfK1pAVl840o+Lcec4x14PGs+ X-Received: by 2002:a17:906:4bcf:: with SMTP id x15mr5921491ejv.145.1623458691705; Fri, 11 Jun 2021 17:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623458691; cv=none; d=google.com; s=arc-20160816; b=mw9vzO0GwKsgd1j39XgXzdkCgB5lAFXPYj2fpLPUoNoUpBDqYcBEIUANvkb5DLGbFC FB/Ed+xq9zKnqeCRFB/vFQplSz4EU+sEwF/XVYm2y7qrxw+oM5MTmX+nZuIUSnap0cGQ 3Ee9otEDc/OJk2UKoQlJTXk99giuBbSw0V9upxPsgRe8u5FVmOHIw41yNCd+qxAL+UQ0 9rWczp2jgCHCILbWNvhnzV17qkPJwWACaWC4AoRtiUHSnhYOaRvV5xFkOt7H2hPMVU3g 59BMaLcSg1AUVudkjSd2VQdJ9H3xvAiJYOYNL9zPccSIJP+YSUhyM/5jUfwaX9XXCSEh fGSQ== 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=FxEV9iata6R86LklafTZvkJMZtuSkpOtZknlBZ5CHkc=; b=RM0PW5ZUBd9Dmiz18135WZaWAvhgthzDmn41CWst0OzUVcPpAfONP2bw5uU3qKilg5 FhzSD9iJ7tLP3sONZ6wJ9JA+CCfzYTPxr+oPXejiPM1p8J8F6SYgbdk8bPsDSnrLr9nI ciqnCIHoEyjRRimrAR4mf6cs+5vxhbofs+RqfmicbpAGAPJ3V/efrQYwJPQbQoAkrOQR TiNGmu0FfFSJO0287sIzdllRKEEJEb456H5TKAdBHlEEVhHrWvDAMZzsOzqrLlzDVVmH ZxFwspBbTUvfyaVt9oSvSa7UtkPxyshqWhPEiIrIAIhv7zBLipkdQilnPNfzVH8qlEat kXqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm3 header.b=rrFAnW00; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=USsl5TdG; 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 gy21si6329395ejb.8.2021.06.11.17.44.29; Fri, 11 Jun 2021 17:44:51 -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=rrFAnW00; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=USsl5TdG; 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 S230265AbhFLApX (ORCPT + 99 others); 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; > > +       }