summaryrefslogtreecommitdiff
path: root/fs/debugfs/internal.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-11-24 19:25:25 +0300
committerJohannes Berg <johannes.berg@intel.com>2023-11-27 13:24:50 +0300
commitf4acfcd4deb158b96595250cc332901b282d15b0 (patch)
treebc06b650955d9bbc41bd889f8f497ecb92e1416b /fs/debugfs/internal.h
parent0ed04a1847a10297595ac24dc7d46b35fb35f90a (diff)
downloadlinux-f4acfcd4deb158b96595250cc332901b282d15b0.tar.xz
debugfs: annotate debugfs handlers vs. removal with lockdep
When you take a lock in a debugfs handler but also try to remove the debugfs file under that lock, things can deadlock since the removal has to wait for all users to finish. Add lockdep annotations in debugfs_file_get()/_put() to catch such issues. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'fs/debugfs/internal.h')
-rw-r--r--fs/debugfs/internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/debugfs/internal.h b/fs/debugfs/internal.h
index f7c489b5a368..c7d61cfc97d2 100644
--- a/fs/debugfs/internal.h
+++ b/fs/debugfs/internal.h
@@ -7,6 +7,7 @@
#ifndef _DEBUGFS_INTERNAL_H_
#define _DEBUGFS_INTERNAL_H_
+#include <linux/lockdep.h>
struct file_operations;
@@ -23,6 +24,11 @@ struct debugfs_fsdata {
struct {
refcount_t active_users;
struct completion active_users_drained;
+#ifdef CONFIG_LOCKDEP
+ struct lockdep_map lockdep_map;
+ struct lock_class_key key;
+ char *lock_name;
+#endif
};
};
};