Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6507691rwi; Mon, 24 Oct 2022 02:18:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DU1I8zXjLZTB8tK73ZmfSR+jaVCErQ8jURO2ERyo5uEkTFNfwJeKlqoAsbLA4SVbrMndY X-Received: by 2002:a05:6a02:186:b0:439:49a3:479b with SMTP id bj6-20020a056a02018600b0043949a3479bmr27677346pgb.171.1666603117715; Mon, 24 Oct 2022 02:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666603117; cv=none; d=google.com; s=arc-20160816; b=NZHuCjuh4MO7L1PtTs8YazXN106hFLoD+A4aBbhMrQQ82BZaTS6Bh0gE76aEIAvIYR L8dHKPymwYW79uS+v/ArYVKffRUbg8PmqBOOrP2Lg5XC6JOB4kIq+mUik4JzklCs95yC y7q4kER/r6k+2lfhes9Y/1zYZeBt37yCIXaiHHRGyMPMc0cL9E0XsVvGiBYVkGXdyJWW 0jc5YfI46BP4VeTmDphCXIPxGYQF74t9g1VaCmR/XRl5m/qRUWgthfwyXg9ZKq+pVYMe W4gi4UFARnFEm1CjjyGuea1dMrWkXItKXMc/DOeiPCGuRWSCERrh73k6jhbrBMCLgOeJ vDSA== 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=I7q4jjZ/11oP0wYx/mP/f1FCsbis6J0C3E07mdpbVVw=; b=RK5YRq0tpXx/6X2UXFtF3MVCdIvzayjdEVYNF7PPGBIbLJM6e9Qp+XbW69EidkCV2N z30gKLuRolCdtF+dUlYoFeTvTx0t2ckvtfUSCPVT4H0u6pG0FjHXDIu8VjwAEpk+96H6 /29Kx4obhe7+VU5OvvglzdqgNC02231MwOIEuBqhnq6NPOnD9K597v9YeVfGJiQXOhv6 V+hy9ciAorTNZS2s5BCXEvl7b7uhLG3UZhAF/pr5KOL+nNeHfOZ0HnbobBeGgBXItmYQ 51MFO7dre+WyC0PzF6zoRUNNJOiEk52tupNkbMqGGsvITtpIrvqjG/hv2kaYIbBtjwxu oDhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=YA02PVXD; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y185-20020a638ac2000000b0044f2a51ef3fsi31787680pgd.687.2022.10.24.02.18.25; Mon, 24 Oct 2022 02:18:37 -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=@szeredi.hu header.s=google header.b=YA02PVXD; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229727AbiJXIiX (ORCPT + 99 others); Mon, 24 Oct 2022 04:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbiJXIiV (ORCPT ); Mon, 24 Oct 2022 04:38:21 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B79604B1 for ; Mon, 24 Oct 2022 01:38:18 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id y12so8149001edc.9 for ; Mon, 24 Oct 2022 01:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=I7q4jjZ/11oP0wYx/mP/f1FCsbis6J0C3E07mdpbVVw=; b=YA02PVXDKsrn9ltaGQq1rVpRNSuTE6y3ch/XBF/kmoNgtADrk+uPVI/iJH7R1txxp5 F0tTK9YMUuDLc6sWPMFcOq13dBSvSF3Kv+jIpzPWAWe+7ltapD+hT0p7do5PG0u8NnEr pQqXFIVu6tXpa8hi8fVni1bPC4VS0mzauSS4E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=I7q4jjZ/11oP0wYx/mP/f1FCsbis6J0C3E07mdpbVVw=; b=x1KPtAxxrKKg1IoJU51c7wPXjMT4GFhHUtOO4V0tsWneDD3UO7nMlShHpbfc0vIwAk XFIgdFhjAMRlLRYjV5UCuapqSzw8pHqf/8c4Bq1KuW6KLyebj2xu3K7tNBqftSXUtPt8 ER0kV7rCWByEkypRakVCkyluAjgLcR2IdEK/0DGKcrgNluAcyFByN2t9PuwahWqB4Jj1 RF7Af4IAUbs4p4f5kOF67Zi+yErS8QwvcJJVZ8kJbQ8k3LmttxLiH6XeYGRHHP5m8rQt ui6Ah3+kbki/OuyznWlsvVNjV+B3Yi9i+JwpuBBVrqtJtnlFy2W75DHvwTP6Lf57DBs2 ihNA== X-Gm-Message-State: ACrzQf17V6C2sTtnwx//Lo8HsTxGRzm10HWnSTBBz2aU97N02AAr5HiO pjW+Z40AYELjq1GsxjxNaeZs4J251mn7TFpk5lzfSA== X-Received: by 2002:a17:907:b1c:b0:797:983a:7d97 with SMTP id h28-20020a1709070b1c00b00797983a7d97mr19041019ejl.267.1666600696615; Mon, 24 Oct 2022 01:38:16 -0700 (PDT) MIME-Version: 1.0 References: <166606025456.13363.3829702374064563472.stgit@donald.themaw.net> <166606036967.13363.9336408133975631967.stgit@donald.themaw.net> In-Reply-To: <166606036967.13363.9336408133975631967.stgit@donald.themaw.net> From: Miklos Szeredi Date: Mon, 24 Oct 2022 10:38:05 +0200 Message-ID: Subject: Re: [PATCH 2/2] kernfs: dont take i_lock on revalidate To: Ian Kent Cc: Greg Kroah-Hartman , Tejun Heo , Minchan Kim , Eric Sandeen , Al Viro , Rick Lindsley , David Howells , Carlos Maiolino , linux-fsdevel , Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham 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, 18 Oct 2022 at 04:32, 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 Reviewed-by: Miklos Szeredi