[PATCH v2 0/2] net: add debugfs files for showing netns refcount tracking info

From: Jeff Layton
Date: Tue Apr 08 2025 - 09:42:53 EST


Recently, I had a need to track down some long-held netns references,
and discovered CONFIG_NET_NS_REFCNT_TRACKER. The main thing that seemed
to be missing from it though is a simple way to view the currently held
references on the netns. This adds files in debugfs for this.

Eric, I didn't incorporate your proposed patch to limit how long this
code spends in ref_tracker_dir_snprint(), as it didn't apply properly.
If you send that as a formal patch, or point me at a branch to base this
on, I can rebase this series on top.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Changes in v2:
- add top-level ref_tracker directory in debugfs, and move net_ns directory under it
- Link to v1: https://lore.kernel.org/r/20250324-netns-debugfs-v1-1-c75e9d5a6266@xxxxxxxxxx

---
Jeff Layton (2):
ref_tracker: add a top level debugfs directory for ref_tracker
net: add debugfs files for showing netns refcount tracking info

include/linux/ref_tracker.h | 3 +
lib/ref_tracker.c | 15 +++++
net/core/net_namespace.c | 151 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 169 insertions(+)
---
base-commit: 695caca9345a160ecd9645abab8e70cfe849e9ff
change-id: 20250324-netns-debugfs-df213b2ab9ce

Best regards,
--
Jeff Layton <jlayton@xxxxxxxxxx>