From cee4e10e4908aa0f3f483d337bc3296680df3828 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 5 Nov 2024 14:01:14 -0700 Subject: [PATCH] LU-17471 osd-ldiskfs: brw_stats symlink module option Add a module option to symlink /proc/fs/lustre/osd-*/*/brw_stats to /sys/kernel/debug/*/*/brw_stats for backward compatibility for systems that need this for monitoring tools that depend on the old /proc pathname instead of always creating it at startup. Otherwise, "lctl get_param osd-ldiskfs.*.brw_stats" will display the stats for both the original and symlinked parameter file, which can confuse other monitoring tools. To enable the /proc/.../brw_stats symlink, add the following line into /etc/modprobe.d/lustre.conf before loading modules/mounting: options osd_ldiskfs symlink_brw_stats=1 By default the symlink is not created, since newer tools should be using the /sys/kernel/debug/.../brw_stats parameter file. Remove sanity test_0f that is verifying the old parameter path, since it is just too messy to get the interoperability correct. Test-Parameters: trivial Fixes: 47ccacd58d ("LU-17471 osd: add symlink for brw_stats") Signed-off-by: Andreas Dilger Change-Id: Ib61630cf2bc89b84af438c811754a85e403ebbe5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56917 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_lproc.c | 7 +++++++ lustre/osd-zfs/osd_lproc.c | 7 +++++++ lustre/tests/except/sanity.0f.ex | 2 ++ lustre/tests/sanity.sh | 14 -------------- 4 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 lustre/tests/except/sanity.0f.ex diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 4d3e9c7..b789e87 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -37,6 +37,10 @@ void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf) } #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 17, 53, 0) +static int symlink_brw_stats; +module_param(symlink_brw_stats, int, 0644); +MODULE_PARM_DESC(symlink_brw_stats, "create /proc brw_stats symlink"); + static void osd_symlink_brw_stats(struct osd_device *osd) { size_t len_root; @@ -46,6 +50,9 @@ static void osd_symlink_brw_stats(struct osd_device *osd) char *p; char *path; + if (!symlink_brw_stats) + return; + OBD_ALLOC(path, PATH_MAX); if (path == NULL) return; diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c index 37b091d..d6b6945 100644 --- a/lustre/osd-zfs/osd_lproc.c +++ b/lustre/osd-zfs/osd_lproc.c @@ -24,6 +24,10 @@ #include "osd_internal.h" #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 17, 53, 0) +static int symlink_brw_stats; +module_param(symlink_brw_stats, int, 0644); +MODULE_PARM_DESC(symlink_brw_stats, "create /proc brw_stats symlink"); + static void osd_symlink_brw_stats(struct osd_device *osd) { size_t len_root; @@ -33,6 +37,9 @@ static void osd_symlink_brw_stats(struct osd_device *osd) char *p; char *path; + if (!symlink_brw_stats) + return; + OBD_ALLOC(path, PATH_MAX); if (path == NULL) return; diff --git a/lustre/tests/except/sanity.0f.ex b/lustre/tests/except/sanity.0f.ex new file mode 100644 index 0000000..7e15dd7 --- /dev/null +++ b/lustre/tests/except/sanity.0f.ex @@ -0,0 +1,2 @@ +#facet op need_version jira space_separated_subtests +mds1 <= 2.14.55-100-g8a84c7f9c7 LU-14927 0f diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 731d0e7..ae0deb6 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -241,20 +241,6 @@ test_0e() { # LU-13417 } run_test 0e "Enable DNE MDT balancing for mkdir in the ROOT" -test_0f() { # LU-17471 - (( $MDS1_VERSION < $(version_code 2.17.53) )) || - skip "MDS >= 2.17.53 removes /proc/.../brw_stats symlink" - (( $MDS1_VERSION < $(version_code 2.14.55-100-g8a84c7f9c7) || - $MDS1_VERSION > $(version_code 2.15.60-25) )) || - skip "MDS was missing /proc/.../brw_stats value" - - local path="lustre/osd-$FSTYPE/$FSNAME-MDT0000/brw_stats" - local out_proc=$(do_facet mds1 grep snapshot_time /proc/fs/$path) - - [[ -n "$out_proc" ]] || error "brw_stats /proc/fs/$path not found" -} -run_test 0f "Symlink to /sys/kernel/debug/*/*/brw_stats should work properly" - test_1() { test_mkdir $DIR/$tdir test_mkdir $DIR/$tdir/d2 -- 1.8.3.1