prog: (The Rev. Sir Dr. George King)
prog ([personal profile] prog) wrote2007-05-22 10:06 am
Entry tags:

Lazyweb: Educate me on NFS

Google and Wikipedia aren't coming through for me on this one:

Imagine that we have a utility which, in the course of its duties, reads and writes files to a file system.

What sorts of behaviors would make it not NFS-safe? I thought NFS was totally transparent to man and beast alike, but perhaps this is not quite so?

[identity profile] novalis.livejournal.com 2007-05-22 02:29 pm (UTC)(link)
I don't know much about NFS, but I recall something about file locking being a bit weird on NFS. This will depend on (a) your version of NFS, (b) the particular technique you use (fcntl, flock, O_EXCL/hard links), and (c) the particular version of the particular kernel you are using.

[identity profile] jtroutman.livejournal.com 2007-05-22 03:23 pm (UTC)(link)
<-- What he said (and in more detail than I could have managed).

By default more NFS setups are not well optimized for speed or usability (you have to tune the settings in /etc/exports). You may or may not want the exported directories to be able to be used with root privs. You may need to deal with "what if" exception conditions in your process start-up. In my experience, a process will simply block forever if the NFS mount is not available (such as if the machine goes away, or connectivity to the machine goes away while it is mounted).

Also, you can't ever have multiple clients append to the same file via NFS.

This site will help you:

http://nfs.sourceforge.net/

[identity profile] ubiquity.livejournal.com 2007-05-22 03:10 pm (UTC)(link)
The only case I know of is if something else is attempting to write to that same file at the same time.