- A new entry was told apart from a fresh one only by its time of 0.
With a timeout at least the current time in seconds, such as
cache.statfs=4294967295, a new entry looked fresh before statvfs
had run, so the zeroed struct was returned as success: every branch
reported no free space and every create failed with ENOSPC, and a
nonexistent path succeeded. 3735d721 applies cache.statfs from the
mount options, which made it reachable from fstab. Give the entry a
valid flag set by the first statvfs.
- 5e74822f stopped caching a failure as a success by retrying it on
every call, under the exclusive lock. With a branch that fails
slowly, such as an unreachable network mount, each caller then
waited for its own failure one after the other: eight callers took
2.4s where 2.42.2 took 0.3s. Keep the failure, as an error, for the
timeout like a success. It is still never returned as zeroed space.
- Read the clock again once the lock is held, so a caller that waited
doesn't compute a negative age against the entry another refreshed.
- Tests: a failure is kept until the timeout, and timeouts of
4294967295 and UINT64_MAX still return real values and errors. Both
fail without this change.
Measure age with a steady clock, starting when statvfs returns. Even a
refresh slower than the configured timeout can be shared by callers
that waited for it; wall-clock adjustments cannot extend its lifetime.