From 83efcfe40411e06acd6cf29412d85b666739fa74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20S=C3=BCtter?= Date: Mon, 4 Aug 2025 11:09:11 +0200 Subject: [PATCH] Fix mount points being collected multiple times in filesystem_linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Markus Sütter --- collector/filesystem_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/collector/filesystem_linux.go b/collector/filesystem_linux.go index 127a3be1..1f1929db 100644 --- a/collector/filesystem_linux.go +++ b/collector/filesystem_linux.go @@ -132,6 +132,11 @@ func (c *filesystemCollector) processStat(labels filesystemLabels) filesystemSta } stuckMountsMtx.Unlock() + // Remove options from labels because options will not be used from this point forward + // and keeping them can lead to errors when the same device is mounted to the same mountpoint + // twice, with different options (metrics would be recorded multiple times). + labels.options = "" + if err != nil { labels.deviceError = err.Error() c.logger.Debug("Error on statfs() system call", "rootfs", rootfsFilePath(labels.mountPoint), "err", err)