Hi,
Thanks for the answer. flock() does support remote locking over nfs (man 2 flock, man 5 nfs) since kernel 2.6.37 by default (local locks have to be specified as a mount option). Assuming a scenario where a client wanted to modify a file, I assume the writes are made to the cache directly (since there is no single source filesystem this is caching), and as you describe, the file is written first as a temporary file, then moved to the original file name. However, I would have expected the error to not be that it couldn’t write the temp file (as these are very likely to be unique with a random GUID in the name, but rather in trying to overwrite the original file, which would have the lock on it.
I’ll take a look at the source code when I get a chance (should have probably done that first really…).
Thanks,
Cam