Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vfs: extend disk-health checking to filesystem metadata operations
Previously, disk stalls while syncing a filesystem directory were undetected, because the health-checking filesystem's OpenDir method did not wrap the directory handle. Additionally, disk stalls during all filesystem metadata operations (eg, file creation, removal, rename, etc) were undetected. These operations are performed directly on a vfs.FS (not a vfs.File), and require an adjusted implementation to accommodate concurrent, write-oriented operations. This commit implements a scheme in which filesystem metadata operations lock a vfs.FS-wide mutex to acquire a 'slot' into which they record their start time. When an operation completes, the operation atomically zeroes its slot without reacquiring the mutex. A long-running goroutine listens on a ticker, periodically acquiring the vfs.FS mutex and scanning the slots for start times older than a threshold. The long-running goroutine is launched lazily by the first filesystem operation to acquire the mutex. A new `io.Closer` return value of `WithDiskHealthChecks` may be used to stop the long-running goroutine. Fix cockroachdb#1643.
- Loading branch information