Whamcloud - gitweb
LU-17418 libcfs: support debug setup for libcfs modules 25/53825/7
authorJames Simmons <jsimmons@infradead.org>
Mon, 5 Feb 2024 02:53:44 +0000 (21:53 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Feb 2024 06:59:18 +0000 (06:59 +0000)
commitd12b18195cedd629e94b5bafecd7c9509484c89f
tree2f962ee98cad485c961a7aaa409d37dbbacebc26
parentaab504fa53fcd048dc4d3f79c925ca300cfb4d07
LU-17418 libcfs: support debug setup for libcfs modules

Work was landed to make Lustre ensure key libcfs components
were initialized for both a module build and a build directly
into the kernel. This change resulted in an defect that allows
you to crash a node when you only load libcfs.ko and run a
user land tool to set a debugfs setting of libcfs. The debug
handling is critical to load before anything. Update Lustre
to handle both a module and builtin setup for Lustre. When
lustre is built into the kernel we can't control if libcfs_init()
is called first so have libcfs_setup() handle setting up the
debug handling. When built as a module have libcfs_init()
setup the debug handling instead. For both cases
libcfs_debug_init() is always called so make sure we only
initialize it only once. Add a test to validate this fix.

Fixes: f3494a6e9 ("LU-9859 libcfs: refactor libcfs initialization.")
Test-Parameters: trivial testlist=conf-sanity env=ONLY="5j"
Change-Id: If4a229e43b9e06a723546c03eb2b787ba0b16f5a
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53825
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/debug.c
libcfs/libcfs/module.c
lustre/tests/conf-sanity.sh [changed mode: 0644->0755]