[OpenAFS] File locking

Nickolai Zeldovich kolya@MIT.EDU
Tue, 07 Jan 2003 14:43:11 -0500

Jayme Cox wrote:

> Is it possible for server #2 to open() the .bic file before the openAFS
> server has broken it's callback?

Yes, that's entirely possible.  If the latency between the server and
the clients is more than the delay between one client closing the file
and the other one opening it, the server has no way to inform the second
client of the first client's update to the file in time.

Moreover, what will probably happen is that the second client will open
the file locally (because it has a callback for it), and old data will
be used for a short period of time.  Then, when the callback from the
file server comes in, the AFS client will fetch the new data, and your
user-land process will see the data magically change underneath it.

Perhaps if your user-land processes require such synchronization, you
should use fcntl locking on the file?  This will make the AFS client
contact the server to obtain a lock on the entire file, and ensure that
you don't get these short windows of inconsistency.

-- kolya