linux/NFSSambaLocking written at 01:03:03; Add Comment
Linux, Samba, NFS, and POSIX locking
We recently upgraded our Samba servers from an old version of Ubuntu and Samba to a new version of both. When we did this, we found that Windows XP machines running Office 2003 stopped being able to save documents in Office 2003 formats. Attempted saves would fail with a more or less generic error, and opening documents would stall for a while and then open them read only.
(Yes, it really is this specific. For example, Office 2003 can save the same files in other formats without problems.)
If you do appropriate searches, the Internet is (relatively) full of people reporting this same problem. Invariably they were upgrading a machine to a relatively modern Linux distribution, and they were using NFS-mounted filesystems (people with local filesystems on their Samba servers don't see this issue). The solution everyone winds up with is turning off POSIX locking in Samba:
posix locking = no
Unsurprisingly, this is what was required for us as well.
(We performed a series of experiments that established that turning off any other single locking-related option was not good enough, although we did not try all possible combinations of other Samba locking options.)
The stuff you find on the Internet stops there, but there is more to the story.
On the surface this sounds like an alarming option to have to turn off, especially in an environment (such as ours) where people can do stuff to their files without going through the Samba server. In practice, we happened to notice that it does not cause Samba to entirely stop doing locking, even locking over NFS. With POSIX locking turned off, locks were still visible both locally and on the NFS fileserver, and we verified things such as that a Unix program locking a target file (on another machine) would cause Office 2003 to stall and then open the file read-only.
(There are probably some things that don't work right, but we were happy enough to verify that general locking still worked.)
As it happens this was a big clue that led us to what is going on, but that's another entry.
PS: if you do this searching, you will also turn up a bunch of Samba people repeatedly saying that you should not use Samba to re-export NFS mounted filesystems. However well intentioned this advice is, it is completely infeasible in any production environment of significant size so ignore those people.
* * *
Atom feeds are available; see the bottom of most pages.