On Tue, 30 Jan 2024 at 00:43, Linus Torvalds <torva...@linux-foundation.org> wrote: > > I'll go back to bed, but I think the fix is something trivial like this:
Almost. > + result = ERR_PTR(ENOENT); That needs a '-' in front of the ENOENT, otherwise you have a positive error number and things go wrong very quickly. And that does indeed fix the lookup problem, but you end up with the same problem later when you do the eventfs_remove_dir(). Again the eventfs data structure changes, but we don't have a reliable dentry that we can invalidate. The dentry cache is just very good at caching those old dentries, and the interface for eventfs_create_dir() and eventfs_remove_dir() is just not great. If those did an actual path lookup (like eventfs_create_events_dir() does), we'd have the dentry, and it's trivial to get from dentry to eventfs_inode. But going the other way is the broken thing because of how the dentries are just temporary caches. I suspect the solution is to make eventfs_create_dir() do the same as the events directory case does, and actually pin the directory dentry and save it off. Oh well. At least I understand what the problem is. Now I'm going to try to go back to sleep. Linus