Files
codex/codex-rs/file-system/src/nfs.rs
T
Dmitriy Kovalenko 9c84e89ce0 Skip SQLite page reclamation on Linux NFS mounts (#54417)
## Why

SQLite page reclamation on NFS creates I/O load and contention.

## What changed

Detect whether `sqlite_home` is on NFS on Linux and skip reclamation before opening a maintenance connection. Cache successful filesystem probes across `SqliteConfig` clones while allowing failed probes to retry.

## Testing

Add tests for shared probe caching and recovery after a missing directory is created. Update reclamation coverage to expect no reclaimed pages or file shrinkage on NFS.

GitOrigin-RevId: 4f627cabc6ad712171654c3f8b8659d2f632bbba
2026-10-15 21:07:40 +00:00

17 lines
562 B
Rust

//! Detects NFS on Linux; other platforms retain their existing filesystem behavior.
//! Closing an extra file descriptor could release process-wide POSIX locks on its inode.
use std::io;
use std::path::Path;
/// On linux we sometimes do a special treatment for NFS related path. We don't support windows NFS
#[cfg(target_os = "linux")]
pub fn is_nfs(path: &Path) -> io::Result<bool> {
Ok(rustix::fs::statfs(path)?.f_type == rustix::fs::NFS_SUPER_MAGIC)
}
#[cfg(not(target_os = "linux"))]
pub fn is_nfs(_path: &Path) -> io::Result<bool> {
Ok(false)
}