I've got quite a bit of code that does flock() on files in AFS, but I've always worked under the assumption that this would only work if a single client is doing the writing. I don't recall whether that assumption was based on empirical testing, reading it somewhere, or being told. In those few cases where this is not practical, I have a designated writer client that other clients connect to through other means (sockets) and coordinate the updates that way. That's reasonably straightforward, but painful enough that I avoid it whenever possible.

Probably not the answer you wanted...
--
[EMAIL PROTECTED]

On 10/27/2008 12:16 PM, Hans-Werner Paulsen wrote:
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 = 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

_______________________________________________
OpenAFS-info mailing list
OpenAFS-info@openafs.org
https://lists.openafs.org/mailman/listinfo/openafs-info

Reply via email to