[OpenAFS] File locking

Craig_Everhart@transarc.com Craig_Everhart@transarc.com
Tue, 7 Jan 2003 14:41:27 -0500 (EST)

Um, does server #1 wait for the close() to complete before telling
server #2 to read the same file?

Also, you're using O_TRUNC in the file open, and you're rewriting the
same file anyway.  Depending on exactly when server #2 opens and reads
the file, it will see incomplete versions of the file.  This would
happen on a local filesystem, such as UFS or ext2, also.  You probably
really want to use file locking to allow this kind of shared file access
to happen in a coordinated way.  The "corrupted" file could be happening
because one of the file write operations, by the time it's stored onto
the server, is overwriting some but not all of the existing data before
completing the O_TRUNC truncation.  Even though this kind of failure
probably wouldn't be happening with a local filesystem, file locking
would avoid it too.