Can I flush the cache for an AFP volume?
Can I flush the cache for an AFP volume?
- Subject: Can I flush the cache for an AFP volume?
- From: James Bucanek <email@hidden>
- Date: Thu, 25 Sep 2008 11:30:52 -0700
Greetings,
There's a long-standing bug in AFP that's causing my application
some occasional grief and I'd like to find a workaround[1].
Imagine if you will
computer S - OS X running personal file sharing
computer R - OS X that has mounted one of S's volumes via AFP
Computer R reads a file from S's volume
Computer S modifies that file
Computer R reads the file again
Occasionally, the data read by computer R the second time is the
same as it was the first. In other words, the file server system
modifies the local file without notifying the file server and/or
the remote computer(s) that their locally cached copy of the
file is now invalid. This sometimes occurs randomly, but there
are specific cases where you can make it happen consistently[2].
So to work around this problem, is there any way to get the
remote computers to flush their local cache and force them to
re-read the file and directory data from the server?
My hair-brained idea is to first open the file using open() then
use fcntl(...,F_NOCACHE,...) to turn the cache off and then back
on for that file. The idea is that this will cause the remote
computer to forget all of the cached data is has about this
file, so that I can then reopen it with FSOpenFork and read the
real data from the server.
Thoughts?
Lastly, if this will work what's the best way of determining
whether a volume is mounted remotely or via AFP?
Footnotes:
[1] If there's a better forum for this, please direct me to it.
The Appleshare-IP list seemed the only other candidate, but it's
very quiet and seems oriented towards end users.
[2] Yes, I've filed a bug report on the reproducible case: 5702911
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden