Limiting negative dentries in Linux kernel discussed at LSFMM+BPF 2026

lwn.net · ⭐️ 8/10 · 2026-07-03

At the 2026 Linux Storage, Filesystem, Memory Management, and BPF Summit, a session led by Miklos Szeredi discussed problems caused by excessive negative dentries in directories, including soft lockups, reference count overflow, and long hash chains. Negative dentries are a key optimization for filesystem lookups, but when a directory accumulates millions of them, they can cause severe performance issues and even security side-channel problems. The proposals discussed could lead to kernel patches that improve filesystem reliability and memory management. Proposed solutions include moving negative dentries to the end of the d_children list so iterators can stop early, adding cond_resched() calls to avoid soft lockups, or switching to a more suitable data structure. Concerns were raised about ordering issues with getdents() and potential complications when a negative dentry becomes positive.

Background

Negative dentries are directory entries that cache the non-existence of a file, speeding up lookups by avoiding repeated filesystem access. The dentry cache stores three types: in-use, unused, and negative. Problems arise when directories have hundreds of millions of negative dentries, causing soft lockups or lockref overflow.

References

Read original