From: Oleg Drokin Date: Sat, 30 Dec 2017 03:16:30 +0000 (-0500) Subject: LU-10444 utils: Don't remount debugfs every time X-Git-Tag: 2.10.57~13 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=767f03b161ae44bd9d33dae7e03e71e73852813f;p=fs%2Flustre-release.git LU-10444 utils: Don't remount debugfs every time Check if debugfs is mounted at /sys/kernel/debug and only mount if it is not. Change-Id: Ib31bd8f7c5c93ab942c6708ed3a4d17a11159e95 Signed-off-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/30675 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: James Simmons --- diff --git a/libcfs/libcfs/util/param.c b/libcfs/libcfs/util/param.c index 74a3726..9facce6 100644 --- a/libcfs/libcfs/util/param.c +++ b/libcfs/libcfs/util/param.c @@ -38,6 +38,8 @@ #include #include #include +#include +#include /** * Get parameter path matching the pattern @@ -67,13 +69,19 @@ cfs_get_param_paths(glob_t *paths, const char *pattern, ...) static bool test_mounted = false; size_t len = strlen(path); char buf[PATH_MAX]; + struct statfs statfsbuf; va_list args; int rc; + if (test_mounted) goto skip_mounting; test_mounted = true; + rc = statfs("/sys/kernel/debug/", &statfsbuf); + if (rc == 0 && statfsbuf.f_type == DEBUGFS_MAGIC) + goto skip_mounting; + if (mount("none", "/sys/kernel/debug", "debugfs", 0, "") == -1) { /* Already mounted or don't have permission to mount is okay */ if (errno != EPERM && errno != EBUSY)