summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin/proc_self_mountinfo.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/proc.plugin/proc_self_mountinfo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/collectors/proc.plugin/proc_self_mountinfo.c b/collectors/proc.plugin/proc_self_mountinfo.c
index 0483749c3..194791603 100644
--- a/collectors/proc.plugin/proc_self_mountinfo.c
+++ b/collectors/proc.plugin/proc_self_mountinfo.c
@@ -360,6 +360,18 @@ struct mountinfo *mountinfo_read(int do_statvfs) {
else {
mi->st_dev = 0;
}
+
+ //try to detect devices with same minor and major modes. Within these,
+ //the larger mount point is considered a bind.
+ struct mountinfo *mt;
+ for(mt = root; mt; mt = mt->next) {
+ if(unlikely(mt->major == mi->major && mt->minor == mi->minor && !(mi->flags & MOUNTINFO_IS_BIND))) {
+ if(strlen(mi->root) < strlen(mt->root))
+ mt->flags |= MOUNTINFO_IS_BIND;
+ else
+ mi->flags |= MOUNTINFO_IS_BIND;
+ }
+ }
}
else {
mi->filesystem = NULL;