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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A84F7C38A2D for ; Mon, 24 Oct 2022 08:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbiJXIiX (ORCPT ); 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-Google-Smtp-Source: AMsMyM6cwWOYmOvAUbrctm2+2xxYfn9PiStTPWchMHlzL+E1TfVKSg06irPVtNqV4V9c2R6o5ri/Ukv7AEtCCeQzUVI= 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" 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