home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.29 / text0029.txt < prev    next >
Encoding:
Text File  |  1992-12-26  |  1.4 KB  |  34 lines

  1. Submitted-by: johnl@iecc.cambridge.ma.us ("John R. Levine")
  2.  
  3. >Submitted-by: lebrun@ll.mit.edu ("Steven F. LeBrun")
  4. >I am looking for a method of file locking what works across NFS
  5. >mounted directories and am interested on what methods other 
  6. >people are using.
  7.  
  8. You aren't likely to get very satisfactory results using record locking.
  9. Many versions of the locking daemon don't work at all, and the crash
  10. recovery seems to me to be hopelessly amateurish.  I've worked on projects
  11. that tried to use record locking and even after doing six backflips to try
  12. and work around the record locking bugs, at least to get to the point that
  13. we didn't just hang if the locking daemon wasn't working, the results
  14. still were not great.
  15.  
  16. The time-honored technique of using a directory as a semaphore and using
  17. mkdir() and rmdir() as lock and unlock works fairly well, although it's
  18. rather slow.  Using link() and unlink() also works, at least on systems
  19. that use the Unix semantics that you can't link on top of an existing
  20. file.
  21.  
  22. If you're serious about having the locks work, in the long run you'll get
  23. much better results if you write your own daemon that listens to a TCP/IP
  24. socket and handles reserve and release messages, or maybe even manages the
  25. file itself and accepts requests to atomically update and read from the
  26. file.
  27.  
  28. Regards,
  29. John Levine, johnl@iecc.cambridge.ma.us, {spdcc|ima|world}!iecc!johnl
  30.  
  31.  
  32. Volume-Number: Volume 29, Number 31
  33.  
  34.