Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1370324pxj; Sat, 8 May 2021 15:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmsSzXSn5PW+VGxq+XHvxZBZRHwYS7L94luug50V+Hsa08A1mOvB7lave5SWqIgUE+v8Kt X-Received: by 2002:a50:d68a:: with SMTP id r10mr20620717edi.90.1620513893026; Sat, 08 May 2021 15:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620513893; cv=none; d=google.com; s=arc-20160816; b=akuRvqTy+pKnc6n35sH7+y55IJGjNLVbocd+fdTLgx8B6j/CYuUX0/qkgqxweU6m5X 85cXroLZA5vq2GPLXY9UyVcZ8JXpmTj7ZeRDTVpIEAZOwl8iUbtv4B5ne7HISE3eSALv dEd8tpt2mLmWiNxfEVewguGuSjlb5dUzT2DoW2GqnmLjyC9QPByYyn7ytBFARGKnG5mQ lACppsTW+/3hJ5BW/C7iUqiBeyxmcKSzJaNxJorWp3dUPQ3/Fm7Kz2T3TrKG1Vwp1Dl6 dcVrqeE08eqPvcstzzvwyqodju8SLO4EoAI8WHN947AdDigzs1wzU52VWGIiAgK/ETDD 3Ylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8qvrf78C1VckxwN+Rd5iRKXM/TVBAx3SQ0yt8T9W1XI=; b=ViUeUuD3/VZW/jFndUmE5zl1qbJ0uJ3Qoa3ioEKcA0RrVGS5Kl5ZHPcOBt4q2rkB0f n4VYrBKMV6QUz3bzw/jz8V65qnDvWSLvhtSkAXl6VZffugphous7HKvul07RCb9E5qZz sotHCOPJZ42y0zm062nov44GcCHhFDhs4Z1QJUfgsDtEux3X1JnVnKn16lmX2qxPfiyP kg9HSxw75xH9QZ+SUEMWfvbFI9EM34vNJ3oWOrj7OSxzqR7/Pkwv3ow2ZBM627QtzIoI oAk4OqxMstm23bO3vGJubv43SU6JebvhaT+29ffIlhUiGkDjEyvZ4f00L7TG0ER5oHdO NTyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DHL714aY; 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 gb35si9171918ejc.209.2021.05.08.15.44.10; Sat, 08 May 2021 15:44:53 -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=@linux-foundation.org header.s=google header.b=DHL714aY; 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 S229549AbhEHWnX (ORCPT + 99 others); Sat, 8 May 2021 18:43:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbhEHWnW (ORCPT ); Sat, 8 May 2021 18:43:22 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42D7AC061574 for ; Sat, 8 May 2021 15:42:19 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id p12so16178152ljg.1 for ; Sat, 08 May 2021 15:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8qvrf78C1VckxwN+Rd5iRKXM/TVBAx3SQ0yt8T9W1XI=; b=DHL714aYp4X3y/ZDPD/BxJq1zv4WKtKia+ktMgIzEElXklJlzicJbZPsvSVxT/1xq/ ll2tgIA7+11guksgQhLfWHypKFmuq96HS2x73V3P8fR1NgWiz+KeFKOCZmlgoTLzSEA6 tLX8U9qAEO26/nlzd5qfUVlzthZNMMtHZNWBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8qvrf78C1VckxwN+Rd5iRKXM/TVBAx3SQ0yt8T9W1XI=; b=fGg7mUE8FtYaJCWrmDSI0CTSIjQ+08Qv6TmRiwhr5JaivWu6PmZnKHPEqnJH7zaF5O tvj4SGZygYXNxDO+5zDJWqz17w0ZhxHImwjuOWaXcdN5kefbpzF7ElQI3bSDD4is8voB Vxv+WvRsIXjwJuPhYielfwGQ7Lx1S8qPKH49wrsvxXKRb3fOV8+bSnCp+0q3kkqDCs0K nLYZs9j1cxiJTKGceVuJoVl8CKYRsJacf/OUbYdo1/p4YOE2SXAvQtcgmxcuyGLmkeq+ C3LobKx/00uiUerMKwXN88HWyKhNR7nzt9JhPbLrfpUPVBnF+Lit2qeGI2Y/wTBomIRg lBGg== X-Gm-Message-State: AOAM533ikfIvT/SBNCrEb1RHTY5Lzdl/3BsnsSnV0EKQWkSgagBtKEuM jJwL152B8xxyq3ncQr75SYkKob6KCIcBxxD8ag0= X-Received: by 2002:a2e:a585:: with SMTP id m5mr13600912ljp.223.1620513737072; Sat, 08 May 2021 15:42:17 -0700 (PDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id u3sm30081ljg.78.2021.05.08.15.42.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 May 2021 15:42:16 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id i9so11353728lfe.13 for ; Sat, 08 May 2021 15:42:16 -0700 (PDT) X-Received: by 2002:a19:c30b:: with SMTP id t11mr11039558lff.421.1620513735912; Sat, 08 May 2021 15:42:15 -0700 (PDT) MIME-Version: 1.0 References: <20210508122530.1971-1-justin.he@arm.com> <20210508122530.1971-2-justin.he@arm.com> In-Reply-To: From: Linus Torvalds Date: Sat, 8 May 2021 15:42:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 1/3] fs: introduce helper d_path_fast() To: Al Viro Cc: Jia He , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Al Viro , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "Eric W . Biederman" , "Darrick J. Wong" , "Peter Zijlstra (Intel)" , Ira Weiny , Eric Biggers , "Ahmed S. Darwish" , "open list:DOCUMENTATION" , Linux Kernel Mailing List , linux-s390 , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 8, 2021 at 2:06 PM Al Viro wrote: > > FWIW, if we go that way, I would make that > > while (dentry != root->dentry || &mnt->mnt != root->mnt) { > int error; > struct dentry *parent = READ_ONCE(dentry->d_parent); Side note: you've added that READ_ONCE() to the parent reading, and I think that's a bug-fix regardless. The old code does that plain parent = dentry->d_parent; (after doing the mountpoint stuff). And d_parent isn't actually guaranteed stable here. It probably does not matter - we are in a RCU read-locked section, so it's not like parent will go away, but in theory we might end up with (for example) pre-fetching a different parent than the one we then walk down. But your READ_ONCE() is definitely the right thing to do (whether we do your re-org or not, and whether we do this "prepend_buffer" thing or not). Do you want to do a final version with your fixes? Linus