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

Hans-Werner Paulsen hans@MPA-Garching.MPG.DE
Thu, 22 Apr 2010 13:15:34 +0200

On Thu, Apr 22, 2010 at 11:19:57AM +0100, Simon Wilkinson wrote:
> Okay, I understand now. And you're right, this is somewhat strange =20
> behaviour, which has been there for years. And it won't help in the =20
> cooperative locking case, sadly.
> When a file is opened RW, and is marked as being dirty, the Unix cache =
> manager stores all of that files details locally - it won't update =20
> stat information in response to callback breaks, nor will it flush =20
> pages that are already in memory, or invalidate chunks on disk. It =20
> does this in an attempt to prevent locally made changes from being =20
> overwritten by those on the server (because AFS is write-on-close, and =
> our conflict resolution strategy is last-closer-wins).

If you are using "flock" to coordinate access to AFS files from programs
running on different machines, it is necessary to get an up-to-date
copy from the fileserver as last step of the "lock" call. And you have
to flush the local cache to the fileserver before you "unlock" the file.
When this is the first step of the flock(LOCK_UN) call, existing programs
using "flock" should work without modifications.

Best regards,

Hans-Werner Paulsen		hans@MPA-Garching.MPG.DE
MPI f=FCr Astrophysik		Tel 089-30000-2602
Karl-Schwarzschild-Str. 1	Fax 089-30000-2235=09
D-85741 Garching