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 2/3] VFS: rename lookup_map to dep_map
Date: Sat,  3 Oct 2026 08:35:43 +1000	[thread overview]
Message-ID: <20261002223746.3248726-3-neilb@ownmail.net> (raw)
In-Reply-To: <20261002223746.3248726-1-neilb@ownmail.net>

From: NeilBrown <neil@brown.name>

lockdep has a number of macros which assume the lockdep_map is in a
field called "dep_map".  If dentry.lookup_map is renamed to dep_map
these macros can be used.

In this patch we can now use might_lock().  In future
lockdep_set_class() will be used.

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

diff --git a/fs/dcache.c b/fs/dcache.c
index 7581ee2981d1..c8116c5805c0 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1958,7 +1958,7 @@ 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",
+	lockdep_init_map(&dentry->dep_map, "DCACHE_PAR_LOOKUP",
 			 &sb->s_type->d_lookup_key, 0);
 
 	if (dentry->d_op && dentry->d_op->d_init) {
@@ -2040,7 +2040,7 @@ struct dentry *d_duplicate(struct dentry *dentry)
 		return ERR_PTR(-ENOMEM);
 
 	new->d_flags |= DCACHE_PAR_LOOKUP;
-	lock_map_acquire_try(&new->lookup_map);
+	lock_map_acquire_try(&new->dep_map);
 	spin_lock(&parent->d_lock);
 	new->d_parent = dget_dlock(parent);
 	hlist_add_head(&new->d_sib, &parent->d_children);
@@ -2806,12 +2806,11 @@ static void d_wait_lookup(struct dentry *dentry)
 {
 	if (likely(d_in_lookup(dentry))) {
 		/*
-		 * Tell lockdep we will wait for the lookup lock, after
-		 * dropping ->d_lock, but won't actually take it.
+		 * Tell lockdep we may wait for the lookup lock, after
+		 * dropping ->d_lock.
 		 */
 		spin_release(&dentry->d_lock.dep_map, _THIS_IP_);
-		lock_map_acquire(&dentry->lookup_map);
-		lock_map_release(&dentry->lookup_map);
+		might_lock(dentry);
 		spin_acquire(&dentry->d_lock.dep_map, 0, 1, _THIS_IP_);
 
 		dentry->d_flags |= DCACHE_LOOKUP_WAITERS;
@@ -2936,7 +2935,7 @@ struct dentry *__d_alloc_parallel(struct dentry *parent,
 	}
 	hlist_bl_add_head(&new->d_in_lookup_hash, b);
 	hlist_bl_unlock(b);
-	lock_map_acquire_try(&new->lookup_map);
+	lock_map_acquire_try(&new->dep_map);
 	return new;
 mismatch:
 	spin_unlock(&dentry->d_lock);
@@ -3035,7 +3034,7 @@ static void __d_lookup_unhash(struct dentry *dentry)
 	b = in_lookup_hash(dentry->d_parent, dentry->d_name.hash);
 	hlist_bl_lock(b);
 	dentry->d_flags &= ~DCACHE_PAR_LOOKUP;
-	lock_map_release(&dentry->lookup_map);
+	lock_map_release(&dentry->dep_map);
 	__hlist_bl_del(&dentry->d_in_lookup_hash);
 	hlist_bl_unlock(b);
 	dentry->waiters = NULL;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index adf239f8205f..796282817181 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -117,7 +117,7 @@ struct dentry {
 					 */
 
 	/* lockdep tracking of DCACHE_PAR_LOOKUP locks */
-	struct lockdep_map		lookup_map;
+	struct lockdep_map		dep_map;
 	struct list_head d_lru;		/* LRU list */
 	struct hlist_node d_sib;	/* child of parent list */
 	struct hlist_head d_children;	/* our children */
@@ -571,7 +571,7 @@ unsigned long vfs_pressure_ratio(unsigned long val);
 static inline void d_lookup_release(struct dentry *dentry)
 {
 	if (d_in_lookup(dentry))
-		lock_map_release(&dentry->lookup_map);
+		lock_map_release(&dentry->dep_map);
 }
 
 /**
@@ -585,7 +585,7 @@ static inline void d_lookup_release(struct dentry *dentry)
 static inline void d_lookup_acquire(struct dentry *dentry)
 {
 	if (d_in_lookup(dentry))
-		lock_map_acquire_try(&dentry->lookup_map);
+		lock_map_acquire_try(&dentry->dep_map);
 }
 
 /**
-- 
2.50.0.107.gf914562f5916.dirty


  parent reply	other threads:[~2026-10-02 22:42 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 ` [PATCH 1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking NeilBrown
2026-10-02 22:35 ` NeilBrown [this message]
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-3-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®