]> 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 ad6a0cb53c3e0d9be0198a53d60aa707997b96e4..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)
@@ -602,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);
@@ -751,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) {
@@ -842,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 */