mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems
@ 2026-10-02 22:35 NeilBrown
  2026-10-02 22:35 ` [PATCH 1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking NeilBrown
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: NeilBrown @ 2026-10-02 22:35 UTC (permalink / raw)
  To: Miklos Szeredi, Amir Goldstein, Alexander Viro,
	Christian Brauner, Borah, Chaitanya Kumar
  Cc: Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel, linux-unionfs

The recent addition of lockdep tracking for in-lookup dentries didn't
take into account the needs of stacking filesystems.  For this we need
different lock keys for different filesystems in the stack.

Thanks,
NeilBrown


 [PATCH 1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking
 [PATCH 2/3] VFS: rename lookup_map to dep_map
 [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking
  2026-10-02 22:35 [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems NeilBrown
@ 2026-10-02 22:35 ` NeilBrown
  2026-10-02 22:35 ` [PATCH 2/3] VFS: rename lookup_map to dep_map NeilBrown
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: NeilBrown @ 2026-10-02 22:35 UTC (permalink / raw)
  To: Miklos Szeredi, Amir Goldstein, Alexander Viro,
	Christian Brauner, Borah, Chaitanya Kumar
  Cc: Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel, linux-unionfs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] VFS: rename lookup_map to dep_map
  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
  2026-10-02 22:35 ` [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map NeilBrown
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: NeilBrown @ 2026-10-02 22:35 UTC (permalink / raw)
  To: Miklos Szeredi, Amir Goldstein, Alexander Viro,
	Christian Brauner, Borah, Chaitanya Kumar
  Cc: Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel, linux-unionfs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map
  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 ` [PATCH 2/3] VFS: rename lookup_map to dep_map NeilBrown
@ 2026-10-02 22:35 ` 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
  4 siblings, 2 replies; 8+ messages in thread
From: NeilBrown @ 2026-10-02 22:35 UTC (permalink / raw)
  To: Miklos Szeredi, Amir Goldstein, Alexander Viro,
	Christian Brauner, Borah, Chaitanya Kumar
  Cc: Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel, linux-unionfs

From: NeilBrown <neil@brown.name>

Now that d_alloc_parallel() locking is tracked by lockdep, ovl needs to
take care that it doesn't trigger on deliberate recursion into
subordinate filesystems.  As ovl can stack over itself, the use
of the per-file_system_type d_lookup_key is not enough.

So provide a .d_init() function to update the map as it already done for
i_rwsem and ovl_inode.lock.

Reported-and-tested-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Link: https://lore.kernel.org/all/e3772a51-eabc-4c31-b73d-f3187bf1b3b2@intel.com/
Fixes: 59492f9991dc ("VFS: add lockdep monitoring of DCACHE_PAR_LOOKUP lock.")
Signed-off-by: NeilBrown <neil@brown.name>
---
 fs/overlayfs/inode.c     |  1 -
 fs/overlayfs/overlayfs.h |  2 ++
 fs/overlayfs/super.c     | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 401cb8c75520..bf40198c8b8a 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -816,7 +816,6 @@ static const struct address_space_operations ovl_aops = {
  * - OVL_I(inode)->lock			(ovl_inode_lock[1])
  * - upper_mnt->mnt_sb->s_writers	(ovl_want_write[0])
  */
-#define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
 
 static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
 {
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index e0d8c6152e9f..64cbe4c4bd3e 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -16,6 +16,8 @@
 #undef pr_fmt
 #define pr_fmt(fmt) "overlayfs: " fmt
 
+#define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
+
 enum ovl_path_type {
 	__OVL_PATH_UPPER	= (1 << 0),
 	__OVL_PATH_MERGE	= (1 << 1),
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index e487597337e8..08147799e47c 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -163,10 +163,28 @@ static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags)
 	return ovl_dentry_revalidate_common(dentry, flags, true);
 }
 
+#ifdef CONFIG_LOCKDEP
+static int ovl_dentry_init(struct dentry *dentry)
+{
+	static struct lock_class_key ovl_d_lock_key[OVL_MAX_NESTING];
+	int depth = dentry->d_sb->s_stack_depth - 1;
+
+	if (WARN_ON_ONCE(depth < 0 || depth >= OVL_MAX_NESTING))
+		depth = 0;
+
+	lockdep_set_class(dentry, &ovl_d_lock_key[depth]);
+
+	return 0;
+}
+#else
+#define ovl_dentry_init NULL
+#endif
+
 static const struct dentry_operations ovl_dentry_operations = {
 	.d_real = ovl_d_real,
 	.d_revalidate = ovl_dentry_revalidate,
 	.d_weak_revalidate = ovl_dentry_weak_revalidate,
+	.d_init = ovl_dentry_init,
 };
 
 #if IS_ENABLED(CONFIG_UNICODE)
@@ -176,6 +194,7 @@ static const struct dentry_operations ovl_dentry_ci_operations = {
 	.d_weak_revalidate = ovl_dentry_weak_revalidate,
 	.d_hash = generic_ci_d_hash,
 	.d_compare = generic_ci_d_compare,
+	.d_init = ovl_dentry_init,
 };
 #endif
 
-- 
2.50.0.107.gf914562f5916.dirty


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Amir Goldstein @ 2026-10-03 12:52 UTC (permalink / raw)
  To: NeilBrown
  Cc: Miklos Szeredi, Alexander Viro, Christian Brauner, Borah,
	Chaitanya Kumar, Jeff Layton, Jan Kara, linux-fsdevel,
	linux-kernel, linux-unionfs

On Sat, Oct 3, 2026 at 12:42 AM NeilBrown <neilb@ownmail.net> wrote:
>
> From: NeilBrown <neil@brown.name>
>
> Now that d_alloc_parallel() locking is tracked by lockdep, ovl needs to
> take care that it doesn't trigger on deliberate recursion into
> subordinate filesystems.  As ovl can stack over itself, the use
> of the per-file_system_type d_lookup_key is not enough.
>
> So provide a .d_init() function to update the map as it already done for
> i_rwsem and ovl_inode.lock.
>
> Reported-and-tested-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
> Link: https://lore.kernel.org/all/e3772a51-eabc-4c31-b73d-f3187bf1b3b2@intel.com/
> Fixes: 59492f9991dc ("VFS: add lockdep monitoring of DCACHE_PAR_LOOKUP lock.")
> Signed-off-by: NeilBrown <neil@brown.name>

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  fs/overlayfs/inode.c     |  1 -
>  fs/overlayfs/overlayfs.h |  2 ++
>  fs/overlayfs/super.c     | 19 +++++++++++++++++++
>  3 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
> index 401cb8c75520..bf40198c8b8a 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -816,7 +816,6 @@ static const struct address_space_operations ovl_aops = {
>   * - OVL_I(inode)->lock                        (ovl_inode_lock[1])
>   * - upper_mnt->mnt_sb->s_writers      (ovl_want_write[0])
>   */
> -#define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
>
>  static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
>  {
> diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
> index e0d8c6152e9f..64cbe4c4bd3e 100644
> --- a/fs/overlayfs/overlayfs.h
> +++ b/fs/overlayfs/overlayfs.h
> @@ -16,6 +16,8 @@
>  #undef pr_fmt
>  #define pr_fmt(fmt) "overlayfs: " fmt
>
> +#define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
> +
>  enum ovl_path_type {
>         __OVL_PATH_UPPER        = (1 << 0),
>         __OVL_PATH_MERGE        = (1 << 1),
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index e487597337e8..08147799e47c 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -163,10 +163,28 @@ static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags)
>         return ovl_dentry_revalidate_common(dentry, flags, true);
>  }
>
> +#ifdef CONFIG_LOCKDEP
> +static int ovl_dentry_init(struct dentry *dentry)
> +{
> +       static struct lock_class_key ovl_d_lock_key[OVL_MAX_NESTING];
> +       int depth = dentry->d_sb->s_stack_depth - 1;
> +
> +       if (WARN_ON_ONCE(depth < 0 || depth >= OVL_MAX_NESTING))
> +               depth = 0;
> +
> +       lockdep_set_class(dentry, &ovl_d_lock_key[depth]);
> +
> +       return 0;
> +}
> +#else
> +#define ovl_dentry_init NULL
> +#endif
> +
>  static const struct dentry_operations ovl_dentry_operations = {
>         .d_real = ovl_d_real,
>         .d_revalidate = ovl_dentry_revalidate,
>         .d_weak_revalidate = ovl_dentry_weak_revalidate,
> +       .d_init = ovl_dentry_init,
>  };
>
>  #if IS_ENABLED(CONFIG_UNICODE)
> @@ -176,6 +194,7 @@ static const struct dentry_operations ovl_dentry_ci_operations = {
>         .d_weak_revalidate = ovl_dentry_weak_revalidate,
>         .d_hash = generic_ci_d_hash,
>         .d_compare = generic_ci_d_compare,
> +       .d_init = ovl_dentry_init,
>  };
>  #endif
>
> --
> 2.50.0.107.gf914562f5916.dirty
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Borah, Chaitanya Kumar @ 2026-10-16  5:47 UTC (permalink / raw)
  To: NeilBrown, Miklos Szeredi, Amir Goldstein, Alexander Viro,
	Christian Brauner
  Cc: Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel, linux-unionfs

Hello Neil,

On 10/3/2026 4:05 AM, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
> 
> Now that d_alloc_parallel() locking is tracked by lockdep, ovl needs to
> take care that it doesn't trigger on deliberate recursion into
> subordinate filesystems.  As ovl can stack over itself, the use
> of the per-file_system_type d_lookup_key is not enough.
> 
> So provide a .d_init() function to update the map as it already done for
> i_rwsem and ovl_inode.lock.
> 

Thank you for the patch. Any idea when this lands in linux-next?

==
Chaitanya

> Reported-and-tested-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
> Link: https://lore.kernel.org/all/e3772a51-eabc-4c31-b73d-f3187bf1b3b2@intel.com/
> Fixes: 59492f9991dc ("VFS: add lockdep monitoring of DCACHE_PAR_LOOKUP lock.")
> Signed-off-by: NeilBrown <neil@brown.name>
> ---
>   fs/overlayfs/inode.c     |  1 -
>   fs/overlayfs/overlayfs.h |  2 ++
>   fs/overlayfs/super.c     | 19 +++++++++++++++++++
>   3 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
> index 401cb8c75520..bf40198c8b8a 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -816,7 +816,6 @@ static const struct address_space_operations ovl_aops = {
>    * - OVL_I(inode)->lock			(ovl_inode_lock[1])
>    * - upper_mnt->mnt_sb->s_writers	(ovl_want_write[0])
>    */
> -#define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
>   
>   static inline void ovl_lockdep_annotate_inode_mutex_key(struct inode *inode)
>   {
> diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
> index e0d8c6152e9f..64cbe4c4bd3e 100644
> --- a/fs/overlayfs/overlayfs.h
> +++ b/fs/overlayfs/overlayfs.h
> @@ -16,6 +16,8 @@
>   #undef pr_fmt
>   #define pr_fmt(fmt) "overlayfs: " fmt
>   
> +#define OVL_MAX_NESTING FILESYSTEM_MAX_STACK_DEPTH
> +
>   enum ovl_path_type {
>   	__OVL_PATH_UPPER	= (1 << 0),
>   	__OVL_PATH_MERGE	= (1 << 1),
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index e487597337e8..08147799e47c 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -163,10 +163,28 @@ static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags)
>   	return ovl_dentry_revalidate_common(dentry, flags, true);
>   }
>   
> +#ifdef CONFIG_LOCKDEP
> +static int ovl_dentry_init(struct dentry *dentry)
> +{
> +	static struct lock_class_key ovl_d_lock_key[OVL_MAX_NESTING];
> +	int depth = dentry->d_sb->s_stack_depth - 1;
> +
> +	if (WARN_ON_ONCE(depth < 0 || depth >= OVL_MAX_NESTING))
> +		depth = 0;
> +
> +	lockdep_set_class(dentry, &ovl_d_lock_key[depth]);
> +
> +	return 0;
> +}
> +#else
> +#define ovl_dentry_init NULL
> +#endif
> +
>   static const struct dentry_operations ovl_dentry_operations = {
>   	.d_real = ovl_d_real,
>   	.d_revalidate = ovl_dentry_revalidate,
>   	.d_weak_revalidate = ovl_dentry_weak_revalidate,
> +	.d_init = ovl_dentry_init,
>   };
>   
>   #if IS_ENABLED(CONFIG_UNICODE)
> @@ -176,6 +194,7 @@ static const struct dentry_operations ovl_dentry_ci_operations = {
>   	.d_weak_revalidate = ovl_dentry_weak_revalidate,
>   	.d_hash = generic_ci_d_hash,
>   	.d_compare = generic_ci_d_compare,
> +	.d_init = ovl_dentry_init,
>   };
>   #endif
>   


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems
  2026-10-02 22:35 [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems NeilBrown
                   ` (2 preceding siblings ...)
  2026-10-02 22:35 ` [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map NeilBrown
@ 2026-10-16  6:57 ` Amir Goldstein
  2026-10-16  8:08 ` Christian Brauner
  4 siblings, 0 replies; 8+ messages in thread
From: Amir Goldstein @ 2026-10-16  6:57 UTC (permalink / raw)
  To: NeilBrown, Christian Brauner
  Cc: Miklos Szeredi, Alexander Viro, Borah, Chaitanya Kumar,
	Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel,
	linux-unionfs

On Sat, Oct 3, 2026 at 12:41 AM NeilBrown <neilb@ownmail.net> wrote:
>
> The recent addition of lockdep tracking for in-lookup dentries didn't
> take into account the needs of stacking filesystems.  For this we need
> different lock keys for different filesystems in the stack.
>
> Thanks,
> NeilBrown
>
>
>  [PATCH 1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking
>  [PATCH 2/3] VFS: rename lookup_map to dep_map
>  [PATCH 3/3] ovl: provide private lockdep class for dentry->dep_map

Christian,

These are fixed to the series you have staged on vfs-7.4.lookup

Best append them to this branch per PR?

I have added my RVB for the ovl patch.

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems
  2026-10-02 22:35 [PATCH 0/3] Fixes for dentry lockdep tracking on stacking filesystems NeilBrown
                   ` (3 preceding siblings ...)
  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
  4 siblings, 0 replies; 8+ messages in thread
From: Christian Brauner @ 2026-10-16  8:08 UTC (permalink / raw)
  To: Miklos Szeredi, Amir Goldstein, Alexander Viro, Borah,
	Chaitanya Kumar, NeilBrown
  Cc: Jeff Layton, Jan Kara, linux-fsdevel, linux-kernel, linux-unionfs

On Sat, 03 Oct 2026 08:35:41 +1000, NeilBrown wrote:
> The recent addition of lockdep tracking for in-lookup dentries didn't
> take into account the needs of stacking filesystems.  For this we need
> different lock keys for different filesystems in the stack.
> 
> Thanks,
> NeilBrown
> 
> [...]

Applied to the vfs-7.4.lookup branch of the vfs/vfs.git tree.
Patches in the vfs-7.4.lookup branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.4.lookup

[1/3] VFS: per-fs-type lockdep key for dentry in-lookup locking
      https://git.kernel.org/vfs/vfs/c/9f611778a273
[2/3] VFS: rename lookup_map to dep_map
      https://git.kernel.org/vfs/vfs/c/11f6be214ba3
[3/3] ovl: provide private lockdep class for dentry->dep_map
      https://git.kernel.org/vfs/vfs/c/a5478f5c226b


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-10-16  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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

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®