Nfs – OS X NFS Automount: “locallocks” ignored

nfs

I'm having an issue with file-locking and auto mounting on OS X.

Here is my auto_master file:

#
# Automounter master map
#
+auto_master        # Use directory service
/net            -hosts      -nobrowse,hidefromfinder,nosuid
/home           auto_home   -nobrowse,hidefromfinder
/Network/Servers    -fstab
/-          -static
/- /etc/auto_nfs

And here is auto_nfs:

# Common Configuration

/Shared/Family          -fstype=nfs,rw,nodev,nosuid,nfc,locallocks nfs://10.0.0.11/Volumes/PDISK3/VDISKS/General1/Groups/Family\ Shared
/Shared/Users/christopher   -fstype=nfs,rw,nodev,nosuid,nfc,locallocks nfs://10.0.0.11/Volumes/PDISK3/VDISKS/General1/Users/christopher
/Shared/Scratch1        -fstype=nfs,rw,nodev,nosuid,nfc,locallocks nfs://10.0.0.11/Volumes/PDISK2/VDISKS/Scratch1

# END Common Configuration

It appears as though locallocks is ignored (the mount command doesn't show it and chflags fails and Finder's info window has a greyed-out Locked box). I've tried all combinations (e.g. nolocks, nolocks,locallocks, etc) to no avail.

While I'm OK with not having locks in general on the NFS side, having the lack of even a facade of locks is causing OS X to go insane if I try to have home directories on the NFS mount.

So: how do I get locks (or even a facade of locks) to work on an NFS share?

Misc details:

The server is an NFS4 server on Linux Mint with exports like this:

/Volumes/PDISK2 10.0.0.2(rw,async,no_subtree_check,insecure,no_root_squash) 10.0.0.3(rw,async,no_subtree_check,insecure,no_root_squash) 10.0.0.0/16(rw,async,no_subtree_check,insecure)
/Volumes/PDISK3 10.0.0.2(rw,async,no_subtree_check,insecure,no_root_squash) 10.0.0.3(rw,async,no_subtree_check,insecure,no_root_squash) 10.0.0.0/16(rw,async,no_subtree_check,insecure)
/Volumes/PDISK4 10.0.0.2(rw,async,no_subtree_check,insecure,no_root_squash) 10.0.0.3(rw,async,no_subtree_check,insecure,no_root_squash) 10.0.0.0/16(rw,async,no_subtree_check,insecure)

(Note: this computer is not one of the computers given root access and will remain that way).

If I set no_auth_rlm on the server, the Locked checkbox is no longer greyed out in the Finder but it won't let me check it (it unchecks itself). If I do this: touch a ; chflags uchg a on one of the mounts, I get:

chflags: a: Operation not supported

Interestingly, chflags nouchg a works, but still doesn't allow chflags uchg a afterwards. Note that it also doesn't work as root from one of the computer given root access.

The accounts are all from an OS X El Capitan Open Directory server. Yes, it is set up correctly (I can absolutely access/write/edit/etc everything, with the exception what what's apparently an OS X bug w.r.t deleting directories from the Finder).

This is cross-posted because there are two main groups who may have come across this: SysAdmins who have integrated OS X into directory groups (hence ServerFault) and OS-X enthusiasts who have tried to do the same thing personally or for a small business and had issues (hence Think Different).

More information, provided by "Heinrich":

This is not really an auto mount problem. Is seems that the mount(8), or mount_nfs(8) program simply ignores most options:

> mount_nfs -o lock,rsize=65535 newserver:/Volumes/Newdata/kits /mnt

> mount|grep /mnt

newserver:/Volumes/Newdata/kits on /mnt (nfs)

> umount /mnt

> mount_nfs -o lock,nodev newserver:/Volumes/Newdata/kits /mnt

> mount|grep /mnt

newserver:/Volumes/Newdata/kits on /mnt (nfs, nodev)

"nodev" is honored, but everything else seems to be ignored.

Best Answer

It seems that mount options aren't actually ignored, it's just that mount does not show them. nfsstat -m shows the NFS parameters given and the actual mount options currently in use for each mount.

locallocks in particular does have an effect: In my setup (macOS Sierra with NFS mounts from a Linux server), the Photos app initially didn't work with its library on the NFS mount (it just hung on start). Only after setting locallocks the Photos app could be used.