diff options
author | Jeff Layton <jlayton@kernel.org> | 2025-06-18 10:24:19 -0400 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-06-19 17:02:04 -0700 |
commit | 65b584f5361163ba539d2c7122ca792c3cc87997 (patch) | |
tree | 666af3f4518e03c0d5c0545340b90a1836632b5f /net/unix/af_unix.c | |
parent | f6dbe294a11028db540e2dedf1929e25b1093e9b (diff) |
ref_tracker: automatically register a file in debugfs for a ref_tracker_dir
Currently, there is no convenient way to see the info that the
ref_tracking infrastructure collects. Attempt to create a file in
debugfs when called from ref_tracker_dir_init().
The file is given the name "class@%px", as having the unmodified address
is helpful for debugging. This should be safe since this directory is only
accessible by root
While ref_tracker_dir_init() is generally called from a context where
sleeping is OK, ref_tracker_dir_exit() can be called from anywhere.
Thus, dentry cleanup must be handled asynchronously.
Add a new global xarray that has entries with the ref_tracker_dir
pointer as the index and the corresponding debugfs dentry pointer as the
value. Instead of removing the debugfs dentry, have
ref_tracker_dir_exit() set a mark on the xarray entry and schedule a
workqueue job. The workqueue job then walks the xarray looking for
marked entries, and removes their xarray entries and the debugfs
dentries.
Because of this, the debugfs dentry can outlive the corresponding
ref_tracker_dir. Have ref_tracker_debugfs_show() take extra care to
ensure that it's safe to dereference the dir pointer before using it.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20250618-reftrack-dbgfs-v15-6-24fc37ead144@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions