At work, I use the Services for Unix NFS server to share source hosted on my Windows XP box over to my Ubuntu box. In general the SFU NFS server performs well (way better than sharing over SMB) and doesn’t cause any problems, except one.
When an nfs client accesses a file hosted on the windows machine, the NFS server opens up a file handle to the file on behalf of the client. The NFS protocol is stateless, however, so the server doesn’t know how long it should keep the file handle open. The server uses a heuristic (a configurable timeout value in the registry) to decide how long it wait for another request from a client to the same file before releasing a handle.
This is all fine, except that while the NFS server has a file handle open, other programs on my Windows box start getting errors when I try to write to that file. The common scenario is code editing — I’m editing a source file on windows, and an invocation of a build on the Linux side accesses that source file. It accesses it usually only very briefly, but now I have to wait for the timeout before the editor can write any changes out again (though issuing a :w! in vim appears to work).
The real solution is to reduce the timeout value. The registry keys are located in:
Look for the keys:
RdWrHandleLifeTime RdWrNfsHandleLifeTime RdWrThreadSleepTime
On my machine they were all initially set to 5 (meaning 5 seconds). I set them all to 1, and now I rarely run into the problem. Thanks go to Ramesh for the original tip.