• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can I flush the cache for an AFP volume?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I flush the cache for an AFP volume?


  • Subject: Re: Can I flush the cache for an AFP volume?
  • From: Jim Luther <email@hidden>
  • Date: Thu, 25 Sep 2008 11:42:56 -0700

You should use a client/server model so that all clients accessing the data through the server (one access point to the file system). Anytime you have shared access to a file on a network server volume from multiple clients (or from an application on the server and a remote client), you're in a race for that data. Exclusive access to a file is the only way to prevent that problem and the only way to guarantee that is a client server model where even a client running on the server system goes through the server to access the data.

And just to make it clear, F_NOCACHE is a hint... not an order. If you look at the corresponding bit in Files.h, kFSNoCacheBit, the comment tries to make that clear by saying "please don't cache this request." F_NOCACHE tells the file system that your application isn't going to need the data read or written in the near future and so your *application* doesn't need it cached. However, the file system may still cache some or all of the data for its own reasons.

- Jim

On Sep 25, 2008, at 11:30 AM, James Bucanek wrote:

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

_______________________________________________ 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
  • Follow-Ups:
    • Re: Can I flush the cache for an AFP volume?
      • From: James Bucanek <email@hidden>
References: 
 >Can I flush the cache for an AFP volume? (From: James Bucanek <email@hidden>)

  • Prev by Date: Can I flush the cache for an AFP volume?
  • Next by Date: Re: Can I flush the cache for an AFP volume?
  • Previous by thread: Can I flush the cache for an AFP volume?
  • Next by thread: Re: Can I flush the cache for an AFP volume?
  • Index(es):
    • Date
    • Thread