On Sat, Mar 29, 2014 at 00:06, Philip Guenther wrote: > As for why our NFS client doesn't do vnode locking, I'll defer to > tedu, beck, and theo, as I wasn't around for that...
Here be killer robot dragon assassins. Let's start with nfs_node.c:nfs_nget(). It returns an nfsnode which is the flip side of a vnode. Is the vnode locked or not? If we find it in the cache, we call vget() and the returned vnode is locked. If we allocate a new vnode, we return with it unlocked. What do the callers expect? Don't forget to search for the nfsm_mtofh macro, it calls nfs_nget too. Let's look at nfs_create(). On error, it calls vrele(newvp), so it clearly expects an unlocked vnode. But the VFS contract for vop_create clearly states that the returned vnode is locked.