kfence: defer kfence_test_init to ensure that kunit debugfs is created
Subsystems (2)
PATCH 1/1 kfence: defer kfence_test_init to ensure that kunit debugfs is created
kfence_test_init and kunit_init both use the same level late_initcall, which means if kfence_test_init linked ahead of kunit_init, kfence_test_init will get a NULL debugfs_rootdir as parent dentry, then kfence_test_init and kfence_debugfs_init both create a debugfs node named "kfence" under debugfs_mount->mnt_root, and it will throw out "debugfs: Directory 'kfence' with parent '/' already present!" with EEXIST. So kfence_test_init should be deferred.
--- mm/kfence/kfence_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kfence/kfence_test.c +1 -1
@@ -852,7 +852,7 @@ static void kfence_test_exit(void)tracepoint_synchronize_unregister (); } -late_initcall (kfence_test_init); +late_initcall_sync (kfence_test_init);module_exit (kfence_test_exit);MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.30.2
Quoted 9 lines · Weizhao Ouyang
kfence_test_initandkunit_initboth use the same levellate_initcall, which means ifkfence_test_initlinked ahead ofkunit_init,kfence_test_initwill get a NULLdebugfs_rootdiras parent dentry, thenkfence_test_initandkfence_debugfs_initboth create a debugfs node named "kfence" underdebugfs_mount->mnt_root, and it will throw out "debugfs: Directory 'kfence' with parent '/' already present!" with EEXIST. Sokfence_test_initshould be deferred.Signed-off-by Weizhao Ouyang <[email protected]>
Thank you.
Quoted 19 lines
--- mm/kfence/kfence_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/kfence/kfence_test.c +1
-2@@ -852,7 +852,7 @@ static void kfence_test_exit(void)tracepoint_synchronize_unregister (); } -late_initcall (kfence_test_init); +late_initcall_sync (kfence_test_init);module_exit (kfence_test_exit);MODULE_LICENSE ("GPL v2" ); --2.30.2