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=-3.8 required=3.0 tests=BAYES_00, 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 64428C43460 for ; Fri, 9 Apr 2021 01:35:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A0DE610CF for ; Fri, 9 Apr 2021 01:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233208AbhDIBfe (ORCPT ); Thu, 8 Apr 2021 21:35:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232918AbhDIBfe (ORCPT ); Thu, 8 Apr 2021 21:35:34 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B46EC061760; Thu, 8 Apr 2021 18:35:22 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lUg37-003sOh-1m; Fri, 09 Apr 2021 01:35:05 +0000 Date: Fri, 9 Apr 2021 01:35:05 +0000 From: Al Viro To: Ian Kent Cc: Greg Kroah-Hartman , Tejun Heo , Brice Goglin , Fox Chen , Rick Lindsley , Miklos Szeredi , David Howells , Eric Sandeen , Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH v3 2/4] kernfs: use VFS negative dentry caching Message-ID: References: <161793058309.10062.17056551235139961080.stgit@mickey.themaw.net> <161793090597.10062.4954029445418116308.stgit@mickey.themaw.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161793090597.10062.4954029445418116308.stgit@mickey.themaw.net> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09, 2021 at 09:15:06AM +0800, Ian Kent wrote: > + parent = kernfs_dentry_node(dentry->d_parent); > + if (parent) { > + const void *ns = NULL; > + > + if (kernfs_ns_enabled(parent)) > + ns = kernfs_info(dentry->d_parent->d_sb)->ns; For any dentry d, we have d->d_parent->d_sb == d->d_sb. All the time. If you ever run into the case where that would not be true, you've found a critical bug. > + kn = kernfs_find_ns(parent, dentry->d_name.name, ns); > + if (kn) > + goto out_bad; > + } Umm... What's to prevent a race with successful rename(2)? IOW, what's there to stabilize ->d_parent and ->d_name while we are in that function?