summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/example/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2026-04-14 00:08:04 +0200
committerJakub Kicinski <kuba@kernel.org>2026-04-14 08:17:01 -0700
commit4a6fe5fe60040c31c25767ca815a06fab35c1eb7 (patch)
tree7762cbeda68c5c6129e07e3e372d89502ee52d65 /tools/tracing/rtla/example/git@git.tavy.me:linux.git
parent34e1a98ff2a87cf4b8de3ccebe9d45273f014aeb (diff)
tools/ynl: Make YnlFamily closeable as a context manager
YnlFamily opens an AF_NETLINK socket in __init__ but has no way to release it other than leaving it to the GC. YnlFamily holds a self reference cycle through SpecFamily's self.family = self in its super().__init__() call, so refcount GC cannot reclaim it and the socket stays open until the cyclic GC runs. If a test creates a guest netns, instantiates a YnlFamily inside it via NetNSEnter(), performs some test case work via Ynl, and then deletes the netns, then the 'ip netns del' only drops the mount binding and cleanup_net in the kernel never runs, so any subsequent test case assertions that objects got cleaned up would fail given this only gets triggered later via cyclic GC run. Add an explicit close() that closes the netlink socket and wire up the __enter__/__exit__ so callers can scope the instance deterministically via 'with YnlFamily(...) as ynl: ...'. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/20260413220809.604592-2-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/tracing/rtla/example/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions