Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1374158rwi; Mon, 31 Oct 2022 15:50:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45tkNHeETc+uf293hY1tHVumtcVQpi6huSGcEMZzFM+uv5/Y2Z9WrapbfWkXeKMxqAAPVO X-Received: by 2002:a50:fe85:0:b0:458:5562:bf1e with SMTP id d5-20020a50fe85000000b004585562bf1emr15528666edt.167.1667256605935; Mon, 31 Oct 2022 15:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667256605; cv=none; d=google.com; s=arc-20160816; b=BWPX8S30DacMMUMXijsExIim6y0Ip6VYpdKQRWpJZuYODTD3JoIVAoSjaTsO6iArUk ngdD5oAtBKCpt/9LCNakqRdfJVeZmfRG7oXuZHLPDIFjBxX5sWyi65Pz1gt3GrxiCpMY EOl+eNedqOSfvMgSg4Jg/L0EjWmb4LQLvevIE+DruW66Ou0LyR7z+sAW+hdcpHy2v1Jd XTROXIdfzaYGSUtRlSBhPar05PbEHxkSHHsLjlgoJka4pv1ZxOr6JVNExVf3oszn5l1V lFa3D/SCIOXblK+poqktncQi4Tni99Q0zgOs2GnIJAi1mMJJ6UfljAGi3wq1m2fU8IpR WpxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=0nXXo4ET/P13Jj8rdh3uTOW4cT8XJXJyx9jFU05ZLVA=; b=Vo1mCl/D5ZAVKbS4/hogHdGzX16hfIUV+9UqvtH/AvcL11pfxTeKVToOXZfrPGyzxl QtFE1/mtYJhzuTvHhJLCyST60nS3kFTozkMCWa596194SnhMsl1wSYNbSFYBHU3EidyI jVu9MR7LQajpaOfXPkMYvstBqRbSIlZJufHQAIr8xmmNx1JBNgbXu7YmZI1OVVVs940U N5zFrMfSGpfn0k4u4QpSDg6WizDmBYIwV4QSpaQul/3Qvm5WSFeiV4Uq8SXSchwKdwXQ /hP69MphuiowVsdq6jjFfKgg9SE81nmDfDh1aCEH2wcuKFxdZ4li/H2gL9SWV6iMVEtr TppA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="FnfW1bL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p26-20020a50cd9a000000b004623028c586si9114861edi.141.2022.10.31.15.49.41; Mon, 31 Oct 2022 15:50:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="FnfW1bL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbiJaWcB (ORCPT + 98 others); Mon, 31 Oct 2022 18:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiJaWb7 (ORCPT ); Mon, 31 Oct 2022 18:31:59 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F399F10FC; Mon, 31 Oct 2022 15:31:54 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id y13so11902616pfp.7; Mon, 31 Oct 2022 15:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=0nXXo4ET/P13Jj8rdh3uTOW4cT8XJXJyx9jFU05ZLVA=; b=FnfW1bL/q3z703IQ/Zn9pzpTb/1ZwJ7fcu92DxFTlWw1BAg3rt6jDLF8PpRwwIqISx YYkLzg1/OUuRCWkIYOsjKfb1TocjnykHRkNRux5xxmVUJeRzXXVXTGoue8psiAW7LySE dr5/Ii+Fi5LKb3SRx47sGLNO3f5c/Xgy/CHunJj/pgIYKJoEprwMkSasnv8fyDbdYpRF yWwM7e7jAeSKbJNwxylU0Pd1ngOx3mwhK73UbyMLVcv98bKufizN/H5zWQMTG41coxds /lTW3P8czL+gpW8ZQwLZGd1Z+AdBJCQH8h1nLRKhdzhREICRfBxEcPvc/VU26nu/9RT2 Sm4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0nXXo4ET/P13Jj8rdh3uTOW4cT8XJXJyx9jFU05ZLVA=; b=rpGofUZYQzrM5K0JzReXMFGSsA7U4PWuLMQJz68KQ/Xv625aGOeoOA50qDzhbQyNUW hnG16DhiaDvqM/MnupcCLUYLwHWlSupb41MzlsKhA5+8VlqokZ/xv4Dxge07rIglD7Lz rsfjKei1whLGkuKI5qe5UFSEgu+EnNHAxt+z2YGgnCrL53LWOgUfY5D2Y+xpgBBducmM SV7IBh8VNNW0/2mOAnR3wceZSSsD8v2n/3GBSp9hPb9knMYQzshZ28fTEUw/B8YVtL6P BcYHhc6cUiMpP+BB+aGEpyLPGmNz2rD/jR8owpT+nMBxRGW8n+jBjfrc/Wk3bq0Hsqnv Wi5g== X-Gm-Message-State: ACrzQf1zRn+Q9e2n1YwM5oPbRk/UUNF454HrAX5ULQTM7UxWimL7YcRV KwaFsSfqNlX5Ogv0nQNi8lM= X-Received: by 2002:a05:6a00:841:b0:56d:3cf5:102e with SMTP id q1-20020a056a00084100b0056d3cf5102emr11673934pfk.47.1667255514365; Mon, 31 Oct 2022 15:31:54 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:ba13]) by smtp.gmail.com with ESMTPSA id x9-20020a628609000000b00563ce1905f4sm5124593pfd.5.2022.10.31.15.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 15:31:52 -0700 (PDT) Sender: Tejun Heo Date: Mon, 31 Oct 2022 12:31:50 -1000 From: Tejun Heo To: Ian Kent Cc: Greg Kroah-Hartman , Minchan Kim , Eric Sandeen , Al Viro , Rick Lindsley , David Howells , Miklos Szeredi , Carlos Maiolino , linux-fsdevel , Kernel Mailing List Subject: Re: [PATCH 2/2] kernfs: dont take i_lock on revalidate Message-ID: References: <166606025456.13363.3829702374064563472.stgit@donald.themaw.net> <166606036967.13363.9336408133975631967.stgit@donald.themaw.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <166606036967.13363.9336408133975631967.stgit@donald.themaw.net> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 18, 2022 at 10:32:49AM +0800, Ian Kent wrote: > In kernfs_dop_revalidate() when the passed in dentry is negative the > dentry directory is checked to see if it has changed and if so the > negative dentry is discarded so it can refreshed. During this check > the dentry inode i_lock is taken to mitigate against a possible > concurrent rename. > > But if it's racing with a rename, becuase the dentry is negative, it > can't be the source it must be the target and it must be going to do > a d_move() otherwise the rename will return an error. > > In this case the parent dentry of the target will not change, it will > be the same over the d_move(), only the source dentry parent may change > so the inode i_lock isn't needed. > > Signed-off-by: Ian Kent Acked-by: Tejun Heo Thanks. -- tejun