Check if debugfs is mounted at /sys/kernel/debug and only
mount if it is not.
Change-Id: Ib31bd8f7c5c93ab942c6708ed3a4d17a11159e95
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: https://review.whamcloud.com/30675
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
#include <unistd.h>
#include <linux/limits.h>
#include <libcfs/util/string.h>
#include <unistd.h>
#include <linux/limits.h>
#include <libcfs/util/string.h>
+#include <sys/vfs.h>
+#include <linux/magic.h>
/**
* Get parameter path matching the pattern
/**
* Get parameter path matching the pattern
static bool test_mounted = false;
size_t len = strlen(path);
char buf[PATH_MAX];
static bool test_mounted = false;
size_t len = strlen(path);
char buf[PATH_MAX];
+ struct statfs statfsbuf;
if (test_mounted)
goto skip_mounting;
test_mounted = true;
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)
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)