How does AFS maintain consistency on read-write files?
AFS uses a mechanism called “callback”. Callback is a promise from the fileserver that the cache version of a file/directory is up-to-date. It is established by the fileserver with the caching of a file. When a file is modified the fileserver breaks the callback. When the user accesses the file again the Cache Manager fetches a new copy if the callback has been broken. The following paragraphs describe AFS callback mechanism in more detail: If I open() fileA and start reading, and you then open() fileA, write() a change ***and close() or fsync()*** the file to get your changes back to the server – at the time the server accepts and writes your changes to the appropriate location on the server disk, the server also breaks callbacks to all clients to which it issued a copy of fileA. So my client receives a message to break the callback on fileA, which it dutifully does. But my application (editor, spreadsheet, whatever I’m using to read fileA) is still running, and doesn’t really care th