Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Oct 2025 04:57:13 +1100
From:      Peter Jeremy <peterj@freebsd.org>
To:        Dave Cottlehuber <dch@skunkwerks.at>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Re: getfsstat(2)  MNT_NOWAIT & stale data for zpool
Message-ID:  <aOal-ZA6K7OOAMsV@server.rulingia.com>
In-Reply-To: <2706a6b0-ef12-440d-9f29-da5b9e597f9b@app.fastmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 2025-Oct-08 15:59:12 +0000, Dave Cottlehuber <dch@skunkwerks.at> wrote:
>When does getfsstat(2) stale info get updated? It seems this can
>be easily more than 15 minutes, based on experiments in prod. It
>can be triggered by running `/bin/df` but not `/bin/df /`, which
>would be preferable.
>
>Background:
>
>I'm using prometheus node_exporter on a zpool to monitor disk usage.
>Right now this is broken, as a zpool can fill up, and node_exporter
>continues to return the old data.
>
>It loops over all filesystems, doing unix.Getfsstat(buf, unix.MNT_NOWAIT),
>which is a wrapper around getfsstat(2) which clearly states:
>
>     Normally mode should be specified as MNT_WAIT.  If mode is set to MNT_NOWAIT, getfsstat() will return the information it has
>     available without requesting an update from each file system.  Thus, some of the information will be out of date, but getfsstat()
>     will not block waiting for information from a file system that is unable to respond.  It will also skip any file system that is in
>     the process of being unmounted, even if the unmount would eventually fail.
>
>Is node_exporter just broken and should be fixed to use MNT_WAIT?
>
>Is there some tunable to refresh this stale data more frequently, 
>or should I just add `/bin/df` to a regular crontab?

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273094 and https://github.com/prometheus/node_exporter/issues/1498

-- 
Peter Jeremy

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmjmpfBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF
QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi
CzSY3A/+M76VD0qvmx1LH21k9zD3AtMJ7B5lKCwtw3+n5KrTUpks+3IzGo46LrjM
7KmMx+ubP4soG6N/d1r9qXnkm1PE7d9pReQ8WN8859j5EqEFKAFDDGFGQwWRKj/i
5Kr8QJtimb6ocrqXCc4gUOZOeuO6X49CHOr6coqwZQ1qcqLj2nod2YMrVIvxWs7q
4de6T54UTM19kP88+bRXWoJ+uRpG02aAayyEIp4Njg+emj+MhNpDmEnNQRO8CSmw
k6BKpQrajyCr3iLQ+TQ6ffQwZippniobTbFJf39O6NM205bXH4CWQ1/sNsQKgUZR
606NA3L0qDPRQV9jvpua1eYlPBZVeun7PFZUi582Z/y//mUeo2HKfiqUjL2qZUdW
0cVcCf4hpaCpbrXo9xvABE8Yll1/YOWohclA/M7qgsE0EBz+W1GJ7/WeZ9jCyL7t
nnX0LnuN9gol/bTmI2WQ2kvf4DAdkNES+9ZQxcKoud2HMP6Og/uPmaRdIISKu5xl
Ukh8TqzsspRjw9XvraNMB2G90/LExxCcihf3/hCi0UFH7J9OvU2/M9wUqmJWSB0O
NlknMaVxS2iyztHU+AVEb7ciGvGl1A52SWhsZVVmwEp91FZ6pQT6JF8A1IURCZhk
p6TD0B2RfQR11RmmI6p/DuMZIvlDXvsWjE2DZ2FliTkdL1oNDn8=
=45km
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aOal-ZA6K7OOAMsV>