Whamcloud - gitweb
LU-13791 mdt: allow using symbolic capability names 18/54118/3
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 21 Feb 2024 00:59:25 +0000 (17:59 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 21 May 2024 18:23:32 +0000 (18:23 +0000)
commit0b0e9162e26216da8f79f9e970c7c9ce38949b16
tree4d5f1dae6f9a4ebc94c302de76a3542704413744
parenta3099b45f6e0ef12acd4e9565183a3dca78b4ed5
LU-13791 mdt: allow using symbolic capability names

Allow "mdt.*.enable_cap_mask" param set and print symbolic names,
similar to the "debug" and "subsystem_debug" parameters.  The
allowed parameter names are in the capabilities(7) man page, in
either upper or lowercase, like cap_chown, cap_dac_read_search,
etc. along with "all" to enable all capabilities if clients are
trusted.  For example:

    lctl set_param -P mdt.lfs-*.enable_cap_mask=+cap_dac_read_search

Since kernel_cap_t is a 64-bit value, enhance cfs_str2mask() to
take u64 mask arguments.  The calling libcfs_debug_str2mask()
sticks with "int mask" for now.

Split the core out from libcfs_debug_mask2str() into a new helper
function cfs_mask2str() so it can be called directly.

Fixes: 54f677651b ("LU-13791 mdt: parameter to tune capabilities")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I3f71f61a17d4d3614e46a526c60e709d9eb825b3
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54118
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_string.h
libcfs/libcfs/debug.c
libcfs/libcfs/libcfs_string.c
libcfs/libcfs/module.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_lproc.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lproc.c
lustre/tests/sanity-sec.sh