On Mon, Jul 07, 2025 at 08:11:43PM +0200, Max Kellermann wrote: > On Mon, Jul 7, 2025 at 8:00 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > Well, it tries to evict all non-busy dentries, along with the ones that > > are only busy due to (non-busy) children, etc. > > But why did you add code that keeps looping if a dead/killed dentry > was found, even though there is no code to do anything with such a > dentry? Huh? That dentry contributes a soon-to-be-gone reference to parent; it's still there in the tree, but it's already in process of being evicted. The parent will remain busy the end of __dentry_kill(). It is *not* dead; if you want slightly distrubing metaphors, it is already beyond resuscitation (that's what the negative refcount indicates), but it has not finished dying yet. DCACHE_DENTRY_KILLED in flags == "it's dead", and those can't be found in the tree/hash/list of aliases/etc. Negative refcount on something found in the tree == "it's busy dying at the moment" and parent is kept busy until that's over. And we *want* those to be findable in the tree - think e.g. of umount. We really don't want to progress to destroying fs-private data structures before all dentries are disconnected from inodes, etc.