On Mon, 17 Apr 2023 15:23:10 -0400 Chuck Lever <cel@xxxxxxxxxx> wrote: > From: Chuck Lever <chuck.lever@xxxxxxxxxx> > > The current cursor-based directory cookie mechanism doesn't work > when a tmpfs filesystem is exported via NFS. This is because NFS > clients do not open directories: each READDIR operation has to open > the directory on the server, read it, then close it. The cursor > state for that directory, being associated strictly with the opened > struct file, is then discarded. > > Directory cookies are cached not only by NFS clients, but also by > user space libraries on those clients. Essentially there is no way > to invalidate those caches when directory offsets have changed on > an NFS server after the offset-to-dentry mapping changes. > > The solution we've come up with is to make the directory cookie for > each file in a tmpfs filesystem stable for the life of the directory > entry it represents. > > Add a per-directory xarray. shmem_readdir() uses this to map each > directory offset (an loff_t integer) to the memory address of a > struct dentry. > How have people survived for this long with this problem? It's a lot of new code - can we get away with simply disallowing exports of tmpfs? How can we maintain this? Is it possible to come up with a test harness for inclusion in kernel selftests?