X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6d2010ae8f7a6078e10b361c6962983bab233e0f..eee3565979933af707c711411001ba11fe406a3c:/bsd/nfs/nfs_lock.c diff --git a/bsd/nfs/nfs_lock.c b/bsd/nfs/nfs_lock.c index f76a9b6d0..aaf567271 100644 --- a/bsd/nfs/nfs_lock.c +++ b/bsd/nfs/nfs_lock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2010 Apple Inc. All rights reserved. + * Copyright (c) 2002-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -155,7 +155,14 @@ nfs_lockd_mount_unregister(struct nfsmount *nmp) kern_return_t kr; lck_mtx_lock(nfs_lock_mutex); + if (nmp->nm_ldlink.tqe_next == NFSNOLIST) { + lck_mtx_unlock(nfs_lock_mutex); + return; + } + TAILQ_REMOVE(&nfs_lockd_mount_list, nmp, nm_ldlink); + nmp->nm_ldlink.tqe_next = NFSNOLIST; + nfs_lockd_mounts--; /* send a shutdown request if there are no more lockd mounts */ @@ -392,9 +399,7 @@ nfs_lockd_send_request(LOCKD_MSG *msg, int interruptable) */ return (EAGAIN); } - return (kr); } - /* * NFS advisory byte-level locks (client) @@ -425,10 +430,9 @@ nfs3_lockd_request( bcopy(saddr, &msg->lm_addr, min(sizeof msg->lm_addr, saddr->sa_len)); if (nmp->nm_vers == NFS_VER3) msg->lm_flags |= LOCKD_MSG_NFSV3; -#if 0 /* not yet */ + if (nmp->nm_sotype != SOCK_DGRAM) msg->lm_flags |= LOCKD_MSG_TCP; -#endif microuptime(&now); starttime = now.tv_sec; @@ -603,7 +607,7 @@ wait_for_granted: ((lastmsg + nmp->nm_tprintf_delay) < now.tv_sec)) { lck_mtx_unlock(&nmp->nm_lock); lastmsg = now.tv_sec; - nfs_down(nmp, thd, 0, NFSSTA_LOCKTIMEO, "lockd not responding"); + nfs_down(nmp, thd, 0, NFSSTA_LOCKTIMEO, "lockd not responding", 0); wentdown = 1; } else lck_mtx_unlock(&nmp->nm_lock); @@ -752,7 +756,7 @@ nfs3_setlock_rpc( LOCKD_MSG *msg; nmp = NFSTONMP(np); - if (!nmp) + if (nfs_mount_gone(nmp)) return (ENXIO); if (!nlop->nlo_open_owner) { @@ -843,7 +847,7 @@ nfs3_getlock_rpc( LOCKD_MSG *msg; nmp = NFSTONMP(np); - if (!nmp) + if (nfs_mount_gone(nmp)) return (ENXIO); /* set up lock message request structure */