Re:Things UNIX can do atomically
by peterwwillis on Wednesday January 06, 2010 @04:05PM
(#1035756)
IIRC opening a file and using link() is about the only portable atomic method of file locking. Works on NFS and pretty much any UNIX. There may have been some other trick to making it work right on NFS but if you're going that far you may just need a lock manager.
[ Parent
| on HN ]
Re:Things UNIX can do atomically
by briansmith on Wednesday January 06, 2010 @07:54PM
(#1036206)
As long as you are using NFSv4 with properly-configured, non-buggy clients and servers, fcntl-based locking will work correctly.
Re:Things UNIX can do atomically
by peterwwillis on Thursday January 07, 2010 @03:15PM
(#1037936)
I agree. If only every client were capable of properly-configured non-buggy NFSv4... Hence why I say the "portable" method is with link(). There are a lot better solutions if you don't have to support crappy clients.