On Fri, 10 May 2024 at 20:36, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > Said that, I seriously suspect that there are loads where it would become > painful. unlink() + creat() is _not_ a rare sequence, and this would > shove an extra negative lookup into each of those. The other side of this is that the "lots of negative dentries after people have removed files" is definitely something that has come up before as a latency problem. So I do wonder if we've just been too worried about not changing the status quo, and maybe the whole "make unlink() turn a positive dentry into a negative one" was always a mis-optimization. I do agree that we might have to do something more complicated, but I think that before we just _assume_ we have to do that, maybe we should just do the simple and stupid thing. Because while "unlink and create" is most definitely a very real pattern, maybe it's not really _so_ common that we should care about it as a primary issue? The reason to keep the negative dentry around is to avoid the unnecessary "->lookup()" followed by "->create()" directory operations. But network filesystems - where that is _particularly_ expensive - end up having done the whole ->atomic_open thing anyway, so maybe that reason isn't as big of a deal as it used to be? And I don't particularly like your "give people a flush ioctl" either. There are security concerns with that one - both for timing and for just basically messing with performance. At the very least, I think it should require write permissions on the directory you are flushing, but I really think we should instead aim to be better about this in the first place. Anyway, in how many loads is that "unlink -> create" pattern more than a very occasional thing? Which is why I think maybe we're just overthinking this and being too timid when saying "we should count negative dentries or something". Linus