mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@ownmail.net>
To: Miklos Szeredi <miklos@szeredi.hu>,
	Amir Goldstein <amir73il@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	"Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Cc: Jeff Layton <jlayton@kernel.org>, Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-unionfs@vger.kernel.org
Subject: [PATCH 1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking
Date: Sat,  3 Oct 2026 08:35:42 +1000	[thread overview]
Message-ID: <20261002223746.3248726-2-neilb@ownmail.net> (raw)
In-Reply-To: <20261002223746.3248726-1-neilb@ownmail.net>

From: NeilBrown <neil@brown.name>

Stacked file-systems might call d_alloc_parallel() in another
file-system while holding an in-lookup dentry is this filesystem.  In
order for lockdep not to report that, we give each file-system-type a
different lockdep key for in-lookup locking.

This matches what is already done for lockdep tracking of i_rwsem.

Fixes: 59492f9991dc ("VFS: add lockdep monitoring of DCACHE_PAR_LOOKUP lock.")
Signed-off-by: NeilBrown <neil@brown.name>
---
 fs/dcache.c        | 4 ++--
 include/linux/fs.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 83790c7a4dee..7581ee2981d1 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1901,7 +1901,6 @@ EXPORT_SYMBOL(d_invalidate);
  
 static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
 {
-	static struct lock_class_key __lookup_key;
 	struct dentry *dentry;
 	char *dname;
 	int err;
@@ -1959,7 +1958,8 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
 	dentry->waiters = NULL;
 	INIT_HLIST_NODE(&dentry->d_sib);
 
-	lockdep_init_map(&dentry->lookup_map, "DCACHE_PAR_LOOKUP", &__lookup_key, 0);
+	lockdep_init_map(&dentry->lookup_map, "DCACHE_PAR_LOOKUP",
+			 &sb->s_type->d_lookup_key, 0);
 
 	if (dentry->d_op && dentry->d_op->d_init) {
 		err = dentry->d_op->d_init(dentry);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f9d1e05e8ae6..0a5bdc71a4a4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2313,6 +2313,8 @@ struct file_system_type {
 	struct lock_class_key i_mutex_key;
 	struct lock_class_key invalidate_lock_key;
 	struct lock_class_key i_mutex_dir_key;
+
+	struct lock_class_key d_lookup_key;
 };
 
 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)

base-commit: 3879f51857325da9bf3cfb073280257cd16ae067
-- 
2.50.0.107.gf914562f5916.dirty


  reply	other threads:[~2026-10-02 22:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 22:35 [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems NeilBrown
2026-10-02 22:35 ` NeilBrown [this message]
2026-10-02 22:35 ` [PATCH 2/3] VFS: rename lookup_map to dep_map NeilBrown
2026-10-02 22:35 ` [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map NeilBrown
2026-10-03 12:52   ` Amir Goldstein
2026-10-16  5:47   ` Borah, Chaitanya Kumar
2026-10-16  6:57 ` [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems Amir Goldstein
2026-10-16  8:08 ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261002223746.3248726-2-neilb@ownmail.net \
    --to=neilb@ownmail.net \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=neil@brown.name \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®