I have a process that relies on detecting file creation on an NFS server.
Usually it works fine, but there's been a few minor glitches recently, due to caching and an NFS rename operation.
We've now got as far as investigating lookupcache
on the NFS server:
lookupcache=mode Specifies how the kernel manages its cache of directory entries for a given mount point. mode can be one of all, none, pos, or positive. This option is supported in kernels 2.6.28 and later.
The Linux NFS client caches the result of all NFS LOOKUP requests. If the requested directory entry exists on the server, the result is referred to as positive. If the requested directory entry does not exist on the server, the result is referred to as negative.
If this option is not specified, or if all is specified, the client assumes both types of directory cache entries are valid until their parent directory's cached attributes expire.
Now, my problem is - I don't really want to globally disable lookupcache
- and I think I'd have to, because of the nature of this process (it hits files in a lot of locations across our NFS estate)
Is there a way I can programatically invalidate the lookupcache and force a LOOKUP? An ioctl
or other system call ideally. What I'm ideally looking for is something that's documented as a reliable approach - I have seen indications that 'opendir; closedir' will trigger a cache-invalidate, but I can't track down a source for this information.
0 Answers