summaryrefslogtreecommitdiff
path: root/scripts/cleanpatch
diff options
context:
space:
mode:
authorMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>2026-09-03 16:51:35 +0500
committerDanilo Krummrich <dakr@kernel.org>2026-09-11 23:13:07 +0200
commit77be3641f3e3a56e42a5ed889372ef395a933f3c (patch)
tree5a8c7b5301e0f623fd75a61dec91846dd3a28822 /scripts/cleanpatch
parentdf2908090cda368b01ff43709f51890076c56157 (diff)
downloadlinux-77be3641f3e3a56e42a5ed889372ef395a933f3c.tar.gz
linux-77be3641f3e3a56e42a5ed889372ef395a933f3c.zip
debugfs: don't warn about uninitialized debugfs for an error parent
Since commit c3a280ff728a ("debugfs: warn if file creation failed due to uninitialized debugfs") every boot with CONFIG_REF_TRACKER=y and CONFIG_DEBUG_FS=y prints two errors before the root filesystem is mounted: debugfs: Unable to create file 'net_refcnt@(____ptrval____)', debugfs is not initialized yet debugfs: Unable to create file 'net_notrefcnt@(____ptrval____)', debugfs is not initialized yet Nothing is actually wrong. Both files show up under /sys/kernel/debug/ref_tracker/ once the system is up. The kernel is reporting an error for a condition the caller has already accounted for. net_ns_init() runs directly from start_kernel(), before any initcall, and calls ref_tracker_dir_init() for init_net's two trackers. debugfs_init() is a core_initcall, so debugfs cannot possibly be up at that point. That is by design: ref_tracker_dir_debugfs() is documented as safe to call again later, and net/core/net_namespace.c has a late_initcall() that re-registers both directories once debugfs exists. ref_tracker also states that intent to debugfs. ref_tracker_debug_dir is initialised to ERR_PTR(-ENOENT) and only gets a real dentry in a late_initcall, so the early call hands debugfs_create_file() a parent that is already an error. debugfs_start_creating() honours that and returns the parent error, but only after the new pr_err() has fired. Move the IS_ERR(parent) check above the debugfs_initialized() test. A caller passing an error parent is propagating an earlier failure, which is the pattern debugfs documents and which the warning is not aimed at. A caller passing a valid or NULL parent too early - the case the warning was added for - still gets it. One behaviour change: an early caller with an error parent now gets PTR_ERR(parent) back instead of -ENOENT. All callers of these interfaces are documented to ignore the return value. Fixes: c3a280ff728a ("debugfs: warn if file creation failed due to uninitialized debugfs") Link: https://lore.kernel.org/all/6d1dc775f7d5e754d734907514534054f682bac5.1781171918.git.yk@y-koj.net/ Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> Tested-by: Yohei Kojima <yk@y-koj.net> Link: https://patch.msgid.link/20260903115135.63210-1-mikhail.v.gavrilov@gmail.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'scripts/cleanpatch')
0 files changed, 0 insertions, 0 deletions