]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/nfs/nfs_lock.c
xnu-4570.71.2.tar.gz
[apple/xnu.git] / bsd / nfs / nfs_lock.c
index f76a9b6d0b9b863703405fd47a5357ef21466d4c..9920f3c89ff6cf5e34d00219e79fcd824ac139b1 100644 (file)
@@ -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", 1);
                                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 */