Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Similar to Concurrent FTP access.

How is concurrent file access handled for NFS? Say that one client is updating/overwriting a file on a NFS server, and a process on the server is reading that same file directly from the file system at the same time. Is there some sort of atomic handling of file read/write in NFS/Linux or do I have to work with tmp files to ensure data consistency?

I'm worried that the process reading the file will get corrupt data.

share|improve this question
up vote 3 down vote accepted

NFS usually comes with the sibling protocol NLM (Network Lock Monitor), but it only works with advisory (i.e. not enforeced) locks.

For this and other issues related to your question, you main want to read "NFS Considered Harmful"

share|improve this answer

These conflicts are usually resolved through locks. It is upon application to ensure proper locking. That said, it needs to be noted that most of applications do tend to lock files, especially during writes.

share|improve this answer

This problem is the same on any multitasking OS filesystem. What stops one process for changing a file that another is using. Locks. Nothing by default stops this. You can trust NLM or other systems if you want butthey can be buggy. We tend to create soft links. If the create fail someone else has the file. Remember to remove the link when you are finished with the file. There are always problems with removing dead locks when machine across the net or applications died as there are more error states, I find it had to believe that any NLM like system gets this 100% correct either.

If you want to guarantee access then you need a special gate-keep server that only allows atomic reads and writes of the whole file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.