--- fs/nfsserver/nfs_nfsdsocket.c.sav 2012-07-08 20:32:37.000000000 -0400 +++ fs/nfsserver/nfs_nfsdsocket.c 2012-07-08 20:42:03.000000000 -0400 @@ -352,7 +352,7 @@ APPLESTATIC void nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, NFSPROC_T *p) { - int error = 0, lktype; + int error = 0, gotref = 0, lktype; vnode_t vp; mount_t mp = NULL; struct nfsrvfh fh; @@ -378,6 +378,11 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, nd->nd_repstat = NFSERR_GARBAGE; goto out; } + gotref = 1; + NFSLOCKV4ROOTMUTEX(); + nfsv4_getref(&nfsv4rootfs_lock, NULL, + NFSV4ROOTLOCKMUTEXPTR, NULL); + NFSUNLOCKV4ROOTMUTEX(); if (nd->nd_procnum == NFSPROC_READ || nd->nd_procnum == NFSPROC_READDIR || nd->nd_procnum == NFSPROC_READLINK || @@ -471,6 +476,11 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, nd->nd_flag &= ~ND_SAVEREPLY; out: + if (gotref != 0) { + NFSLOCKV4ROOTMUTEX(); + nfsv4_relref(&nfsv4rootfs_lock); + NFSUNLOCKV4ROOTMUTEX(); + } NFSEXITCODE2(0, nd); }