[OpenAFS] sqlite on AFS will not work, even with whole-file locking

Simon Wilkinson sxw@inf.ed.ac.uk
Wed, 21 Apr 2010 15:30:30 +0100

On 21 Apr 2010, at 14:26, Hans-Werner Paulsen wrote:

> On Wed, Apr 21, 2010 at 08:46:54AM -0400, Derrick Brashear wrote:
>> if you have a valid callback, the file better be up to date. uh....
> Hm, I do not understand. I have the following code on one client:
> (1) fd = open("afs-file",O_RDWR)
> (2) flock(fd,LOCK_EX)
> ...
> When the file is modified on the fileserver after (1) and before (2)
> the copy on the client is NOT up to date (the file is opened O_RDWR).

I strongly suspect that the copy on the client is up to date, at least  
according to the server. However, it may well be out of data according  
to the machine which made the modification. That machine only writes  
its changes back to the server on receipt of a fflush or close (or  
when it's cache fills, and it needs to shed some dirty chunks).

So, if there is a problem here, it's going to be related to the fact  
that we aren't flushing when a lock is released, rather than our  
behaviour on obtaining a lock. Perhaps you could verify that case?