[OpenAFS] flock on AFS files

Hans-Werner Paulsen hans@MPA-Garching.MPG.DE
Mon, 27 Oct 2008 17:16:45 +0100


Hello,
today I am totally confused how the flock(2) call should work on
AFS files.
Normally locking works in the following way:
1	 fd =3D open("afs-file",O_RDWR)
	 do something
2	 flock(fd,LOCK_EX)
	 do something with "afs-file"
3	 flock(fd,LOCK_UN)
	 do something
4	 close(fd)

When there are two processes (on different machines) executing that
code, the (2) flock call has to update the local copy of the afs-file,
otherwise locking is useless. And the (3) flock call has to sync the
local copy with the fileserver.
Writing a small test program I see that this synchronization isn't done.
How can I use the flock(2) call on AFS files?
Thank you for any help,

HW

--=20
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