On 06/13/2012 03:02 AM, Sabyasachi Ruj wrote: >> So maybe the time when you gain an exclusive lock on a file is the >> appropriate time to flush your local cache? > > I used exclusive lock is just for a simplified demonstration. In > reality, a shared read lock will be used when just reading from the > file is enough. I that case, the right time to flush local cache would > be whenever any *lock* is obtained. FWIW, here are a couple fuse patches that allow your test program to work: - The first has been posted upstream and fixes an issue where fuse wouldn't invalidate cache of a file unless the file size has changed: http://thread.gmane.org/gmane.comp.file-systems.fuse.devel/11589 - The second I just cooked up to always invoke the revalidation in the read path. It currently only revalidates if a read is attempted beyond EOF (to ensure the size attribute is valid). I've only lightly tested so far to see how it behaves with your test. The patch is attached. Note that AFAICS this would still be a problem when using splice. Brian