Lines Matching refs:clp

205 #define	NETFAMILY(clp) \  argument
206 (((clp)->nfsc_flags & NFSCLFLAGS_AFINET6) ? AF_INET6 : AF_INET)
217 struct nfsclclient *clp; in nfscl_open() local
243 ret = nfscl_getcl(vp->v_mount, cred, p, false, firstref, &clp); in nfscl_open()
260 LIST_FOREACH(dp, NFSCLDELEGHASH(clp, nfhp, fhlen), nfsdl_hash) { in nfscl_open()
280 ohp = &clp->nfsc_owner; in nfscl_open()
290 nfscl_newopen(clp, dp, &owp, &nowp, &op, &nop, own, nfhp, fhlen, in nfscl_open()
347 nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp, in nfscl_newopen() argument
366 nowp->nfsow_clp = clp; in nfscl_newopen()
375 LIST_INSERT_HEAD(&clp->nfsc_owner, nowp, nfsow_list); in nfscl_newopen()
406 TAILQ_REMOVE(&clp->nfsc_deleg, dp, nfsdl_list); in nfscl_newopen()
407 TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, in nfscl_newopen()
412 LIST_INSERT_HEAD(NFSCLOPENHASH(clp, fhp, fhlen), in nfscl_newopen()
431 nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, in nfscl_deleg() argument
451 tdp = nfscl_finddeleg(clp, nfhp, fhlen); in nfscl_deleg()
457 TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, nfsdl_list); in nfscl_deleg()
458 LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, fhlen), dp, in nfscl_deleg()
462 clp->nfsc_delegcnt++; in nfscl_deleg()
472 TAILQ_REMOVE(&clp->nfsc_deleg, tdp, nfsdl_list); in nfscl_deleg()
474 TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, in nfscl_deleg()
476 LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, in nfscl_deleg()
498 nfscl_finddeleg(struct nfsclclient *clp, u_int8_t *fhp, int fhlen) in nfscl_finddeleg() argument
502 LIST_FOREACH(dp, NFSCLDELEGHASH(clp, fhp, fhlen), nfsdl_hash) { in nfscl_finddeleg()
520 struct nfsclclient *clp; in nfscl_getstateid() local
576 clp = nfscl_findcl(nmp); in nfscl_getstateid()
577 if (clp == NULL) { in nfscl_getstateid()
585 while ((clp->nfsc_flags & NFSCLFLAGS_RECVRINPROG)) in nfscl_getstateid()
586 (void) nfsmsleep(&clp->nfsc_flags, NFSCLSTATEMUTEXPTR, in nfscl_getstateid()
592 LIST_FOREACH(dp, NFSCLDELEGHASH(clp, nfhp, fhlen), nfsdl_hash) { in nfscl_getstateid()
606 TAILQ_REMOVE(&clp->nfsc_deleg, dp, in nfscl_getstateid()
608 TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, in nfscl_getstateid()
633 error = nfscl_getopen(NULL, clp->nfsc_openhash, nfhp, fhlen, in nfscl_getstateid()
655 oph = NFSCLOPENHASH(clp, nfhp, fhlen); in nfscl_getstateid()
837 struct nfsclclient *clp; in nfscl_openrelease() local
848 clp = owp->nfsow_clp; in nfscl_openrelease()
851 nfscl_clrelease(clp); in nfscl_openrelease()
869 struct nfsclclient *clp; in nfscl_getcl() local
900 clp = nmp->nm_clp; in nfscl_getcl()
901 if (clp == NULL) { in nfscl_getcl()
906 clp = newclp; in nfscl_getcl()
907 clp->nfsc_idlen = idlen; in nfscl_getcl()
908 LIST_INIT(&clp->nfsc_owner); in nfscl_getcl()
909 TAILQ_INIT(&clp->nfsc_deleg); in nfscl_getcl()
910 TAILQ_INIT(&clp->nfsc_layout); in nfscl_getcl()
911 LIST_INIT(&clp->nfsc_devinfo); in nfscl_getcl()
913 LIST_INIT(&clp->nfsc_deleghash[i]); in nfscl_getcl()
915 LIST_INIT(&clp->nfsc_openhash[i]); in nfscl_getcl()
917 LIST_INIT(&clp->nfsc_layouthash[i]); in nfscl_getcl()
918 clp->nfsc_flags = NFSCLFLAGS_INITED; in nfscl_getcl()
919 clp->nfsc_delegcnt = 0; in nfscl_getcl()
920 clp->nfsc_deleghighwater = NFSCLDELEGHIGHWATER; in nfscl_getcl()
921 clp->nfsc_layoutcnt = 0; in nfscl_getcl()
922 clp->nfsc_layouthighwater = NFSCLLAYOUTHIGHWATER; in nfscl_getcl()
923 clp->nfsc_clientidrev = 1; in nfscl_getcl()
924 clp->nfsc_cbident = nfscl_nextcbident(); in nfscl_getcl()
925 nfscl_fillclid(nmp->nm_clval, uuid, clp->nfsc_id, in nfscl_getcl()
926 clp->nfsc_idlen); in nfscl_getcl()
927 LIST_INSERT_HEAD(&nfsclhead, clp, nfsc_list); in nfscl_getcl()
928 nmp->nm_clp = clp; in nfscl_getcl()
929 clp->nfsc_nmp = nmp; in nfscl_getcl()
934 while ((clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID) == 0 && !igotlock && in nfscl_getcl()
936 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, in nfscl_getcl()
948 nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, in nfscl_getcl()
950 nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); in nfscl_getcl()
969 if ((clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID) == 0) { in nfscl_getcl()
974 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_getcl()
993 if (clp->nfsc_renew > 0) in nfscl_getcl()
994 clidinusedelay = NFSCL_LEASE(clp->nfsc_renew) * 2; in nfscl_getcl()
999 error = nfsrpc_setclient(nmp, clp, 0, NULL, cred, p); in nfscl_getcl()
1019 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_getcl()
1023 clp->nfsc_flags |= NFSCLFLAGS_HASCLIENTID; in nfscl_getcl()
1027 nfsv4_unlock(&clp->nfsc_lock, 1); in nfscl_getcl()
1031 *clpp = clp; in nfscl_getcl()
1041 struct nfsclclient *clp; in nfscl_findcl() local
1043 clp = nmp->nm_clp; in nfscl_findcl()
1044 if (clp == NULL || !(clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) in nfscl_findcl()
1046 return (clp); in nfscl_findcl()
1053 nfscl_clrelease(struct nfsclclient *clp) in nfscl_clrelease() argument
1056 if (clp->nfsc_lock.nfslock_lock & NFSV4LOCK_LOCK) in nfscl_clrelease()
1057 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_clrelease()
1059 nfsv4_relref(&clp->nfsc_lock); in nfscl_clrelease()
1066 nfscl_clientrelease(struct nfsclclient *clp) in nfscl_clientrelease() argument
1070 if (clp->nfsc_lock.nfslock_lock & NFSV4LOCK_LOCK) in nfscl_clientrelease()
1071 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_clientrelease()
1073 nfsv4_relref(&clp->nfsc_lock); in nfscl_clientrelease()
1088 struct nfsclclient *clp; in nfscl_getbytelock() local
1129 clp = rclp; in nfscl_getbytelock()
1132 &clp); in nfscl_getbytelock()
1161 ldp = dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, in nfscl_getbytelock()
1175 ret = nfscl_getopen(NULL, clp->nfsc_openhash, in nfscl_getbytelock()
1180 TAILQ_REMOVE(&clp->nfsc_deleg, dp, nfsdl_list); in nfscl_getbytelock()
1181 TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, nfsdl_list); in nfscl_getbytelock()
1192 error = nfscl_getopen(NULL, clp->nfsc_openhash, in nfscl_getbytelock()
1199 error = nfscl_localconflict(clp, np->n_fhp->nfh_fh, in nfscl_getbytelock()
1203 nfscl_clrelease(clp); in nfscl_getbytelock()
1255 nfscl_clrelease(clp); in nfscl_getbytelock()
1284 struct nfsclclient *clp, void *id, int flags, in nfscl_relbytelock() argument
1325 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, in nfscl_relbytelock()
1349 LIST_FOREACH(op, NFSCLOPENHASH(clp, np->n_fhp->nfh_fh, in nfscl_relbytelock()
1390 nfscl_releasealllocks(struct nfsclclient *clp, vnode_t vp, NFSPROC_T *p, in nfscl_releasealllocks() argument
1401 LIST_FOREACH(op, NFSCLOPENHASH(clp, np->n_fhp->nfh_fh, in nfscl_releasealllocks()
1415 nfscl_clrelease(clp); in nfscl_releasealllocks()
1431 struct nfsclclient *clp; in nfscl_checkwritelocked() local
1463 error = nfscl_getcl(vp->v_mount, cred, p, false, true, &clp); in nfscl_checkwritelocked()
1472 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_checkwritelocked()
1476 nfscl_clrelease(clp); in nfscl_checkwritelocked()
1492 nfscl_clrelease(clp); in nfscl_checkwritelocked()
1503 LIST_FOREACH(op, NFSCLOPENHASH(clp, np->n_fhp->nfh_fh, in nfscl_checkwritelocked()
1519 nfscl_clrelease(clp); in nfscl_checkwritelocked()
1527 nfscl_clrelease(clp); in nfscl_checkwritelocked()
1538 struct nfsclclient *clp; in nfscl_lockrelease() local
1543 clp = lp->nfsl_open->nfso_own->nfsow_clp; in nfscl_lockrelease()
1549 nfscl_clrelease(clp); in nfscl_lockrelease()
1603 nfscl_expireopen(struct nfsclclient *clp, struct nfsclopen *op, in nfscl_expireopen() argument
1636 nfscl_deleg(nmp->nm_mountp, clp, op->nfso_fh, in nfscl_expireopen()
1765 nfscl_cleanclient(struct nfsclclient *clp) in nfscl_cleanclient() argument
1772 TAILQ_FOREACH_SAFE(lyp, &clp->nfsc_layout, nfsly_list, nlyp) in nfscl_cleanclient()
1775 LIST_FOREACH_SAFE(dip, &clp->nfsc_devinfo, nfsdi_list, ndip) in nfscl_cleanclient()
1779 LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { in nfscl_cleanclient()
1791 nfscl_expireclient(struct nfsclclient *clp, struct nfsmount *nmp, in nfscl_expireclient() argument
1802 dp = TAILQ_FIRST(&clp->nfsc_deleg); in nfscl_expireclient()
1812 LIST_FOREACH(towp, &clp->nfsc_owner, nfsow_list) { in nfscl_expireclient()
1833 LIST_INSERT_HEAD(NFSCLOPENHASH(clp, op->nfso_fh, in nfscl_expireclient()
1841 owp->nfsow_clp = clp; in nfscl_expireclient()
1842 LIST_INSERT_HEAD(&clp->nfsc_owner, owp, nfsow_list); in nfscl_expireclient()
1843 LIST_INSERT_HEAD(NFSCLOPENHASH(clp, op->nfso_fh, in nfscl_expireclient()
1858 nfscl_freedeleg(&clp->nfsc_deleg, dp, true); in nfscl_expireclient()
1861 if (!TAILQ_EMPTY(&clp->nfsc_deleg)) in nfscl_expireclient()
1867 LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { in nfscl_expireclient()
1870 ret = nfscl_expireopen(clp, op, nmp, cred, p); in nfscl_expireclient()
1886 nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) in nfscl_cleanup_common() argument
1893 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { in nfscl_cleanup_common()
1903 owp = LIST_FIRST(&clp->nfsc_owner); in nfscl_cleanup_common()
1928 nfscl_cleanupkext(struct nfsclclient *clp, struct nfscllockownerfhhead *lhp) in nfscl_cleanupkext() argument
1944 LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { in nfscl_cleanupkext()
1953 nfscl_cleanup_common(clp, own); in nfscl_cleanupkext()
1964 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { in nfscl_cleanupkext()
1969 nfscl_cleanup_common(clp, own); in nfscl_cleanupkext()
2036 struct nfsclclient *clp; in nfscl_umount() local
2066 clp = nmp->nm_clp; in nfscl_umount()
2067 if (clp != NULL) { in nfscl_umount()
2068 if ((clp->nfsc_flags & NFSCLFLAGS_INITED) == 0) in nfscl_umount()
2075 clp->nfsc_flags |= NFSCLFLAGS_UMOUNT; in nfscl_umount()
2076 while (clp->nfsc_flags & NFSCLFLAGS_HASTHREAD) in nfscl_umount()
2077 (void)mtx_sleep(clp, NFSCLSTATEMUTEXPTR, PWAIT, in nfscl_umount()
2085 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, in nfscl_umount()
2095 LIST_REMOVE(clp, nfsc_list); in nfscl_umount()
2096 nfscl_delegreturnall(clp, p, dhp); in nfscl_umount()
2100 nfsrpc_destroyclient(nmp, clp, cred, p); in nfscl_umount()
2102 nfsrpc_setclient(nmp, clp, 0, NULL, cred, p); in nfscl_umount()
2103 nfscl_cleanclient(clp); in nfscl_umount()
2106 free(clp, M_NFSCLCLIENT); in nfscl_umount()
2118 nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred, in nfscl_recover() argument
2142 clp->nfsc_flags |= NFSCLFLAGS_RECVRINPROG; in nfscl_recover()
2144 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, in nfscl_recover()
2149 nmp = clp->nfsc_nmp; in nfscl_recover()
2157 TAILQ_FOREACH_SAFE(lyp, &clp->nfsc_layout, nfsly_list, nlyp) in nfscl_recover()
2159 TAILQ_INIT(&clp->nfsc_layout); in nfscl_recover()
2161 LIST_INIT(&clp->nfsc_layouthash[i]); in nfscl_recover()
2166 error = nfsrpc_setclient(nmp, clp, 1, retokp, cred, p); in nfscl_recover()
2172 clp->nfsc_flags &= ~(NFSCLFLAGS_RECOVER | in nfscl_recover()
2174 wakeup(&clp->nfsc_flags); in nfscl_recover()
2175 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_recover()
2179 clp->nfsc_flags |= NFSCLFLAGS_HASCLIENTID; in nfscl_recover()
2180 clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; in nfscl_recover()
2208 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) in nfscl_recover()
2218 owp = LIST_FIRST(&clp->nfsc_owner); in nfscl_recover()
2227 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { in nfscl_recover()
2259 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { in nfscl_recover()
2323 nfscl_expireclient(clp, nmp, tcred, p); in nfscl_recover()
2339 dp = TAILQ_FIRST(&clp->nfsc_deleg); in nfscl_recover()
2353 nowp->nfsow_clp = clp; in nfscl_recover()
2424 nfscl_expireclient(clp, nmp, tcred, p); in nfscl_recover()
2433 nfscl_freedeleg(&clp->nfsc_deleg, dp, true); in nfscl_recover()
2475 clp->nfsc_flags &= ~NFSCLFLAGS_RECVRINPROG; in nfscl_recover()
2476 wakeup(&clp->nfsc_flags); in nfscl_recover()
2477 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_recover()
2490 nfscl_hasexpired(struct nfsclclient *clp, u_int32_t clidrev, NFSPROC_T *p) in nfscl_hasexpired() argument
2500 if (clp == NULL || clidrev != clp->nfsc_clientidrev) in nfscl_hasexpired()
2509 clp->nfsc_flags |= NFSCLFLAGS_EXPIREIT; in nfscl_hasexpired()
2511 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, in nfscl_hasexpired()
2513 } while (!igotlock && (clp->nfsc_flags & NFSCLFLAGS_EXPIREIT)); in nfscl_hasexpired()
2514 if ((clp->nfsc_flags & NFSCLFLAGS_EXPIREIT) == 0) { in nfscl_hasexpired()
2516 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_hasexpired()
2520 clp->nfsc_flags |= NFSCLFLAGS_RECVRINPROG; in nfscl_hasexpired()
2523 nmp = clp->nfsc_nmp; in nfscl_hasexpired()
2529 error = nfsrpc_setclient(nmp, clp, 0, NULL, cred, p); in nfscl_hasexpired()
2535 clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; in nfscl_hasexpired()
2540 nfscl_expireclient(clp, nmp, cred, p); in nfscl_hasexpired()
2542 clp->nfsc_flags |= NFSCLFLAGS_HASCLIENTID; in nfscl_hasexpired()
2543 clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; in nfscl_hasexpired()
2545 clp->nfsc_flags &= ~(NFSCLFLAGS_EXPIREIT | NFSCLFLAGS_RECVRINPROG); in nfscl_hasexpired()
2546 wakeup(&clp->nfsc_flags); in nfscl_hasexpired()
2547 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_hasexpired()
2718 nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) in nfscl_renewthread() argument
2744 clp->nfsc_flags |= NFSCLFLAGS_HASTHREAD; in nfscl_renewthread()
2745 mp = clp->nfsc_nmp->nm_mountp; in nfscl_renewthread()
2750 if (clp->nfsc_flags & NFSCLFLAGS_RECOVER) { in nfscl_renewthread()
2763 clp->nfsc_renew; in nfscl_renewthread()
2768 nfscl_recover(clp, &retok, cred, p); in nfscl_renewthread()
2770 if (clp->nfsc_expire <= NFSD_MONOSEC && in nfscl_renewthread()
2771 (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { in nfscl_renewthread()
2772 clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; in nfscl_renewthread()
2773 clidrev = clp->nfsc_clientidrev; in nfscl_renewthread()
2774 error = nfsrpc_renew(clp, NULL, cred, p); in nfscl_renewthread()
2779 clp->nfsc_flags |= NFSCLFLAGS_RECOVER; in nfscl_renewthread()
2782 (void) nfscl_hasexpired(clp, clidrev, p); in nfscl_renewthread()
2786 if (NFSHASNFSV4N(clp->nfsc_nmp)) { in nfscl_renewthread()
2788 NFSLOCKMNT(clp->nfsc_nmp); in nfscl_renewthread()
2790 dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); in nfscl_renewthread()
2797 clp->nfsc_renew; in nfscl_renewthread()
2798 NFSUNLOCKMNT(clp->nfsc_nmp); in nfscl_renewthread()
2799 (void)nfsrpc_renew(clp, dsp, cred, p); in nfscl_renewthread()
2804 NFSUNLOCKMNT(clp->nfsc_nmp); in nfscl_renewthread()
2811 nfscl_totalrecall(clp); in nfscl_renewthread()
2816 LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { in nfscl_renewthread()
2829 dp = TAILQ_FIRST(&clp->nfsc_deleg); in nfscl_renewthread()
2838 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renewthread()
2851 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, in nfscl_renewthread()
2860 ret = nfscl_recalldeleg(clp, clp->nfsc_nmp, dp, in nfscl_renewthread()
2864 TAILQ_REMOVE(&clp->nfsc_deleg, dp, in nfscl_renewthread()
2868 clp->nfsc_delegcnt--; in nfscl_renewthread()
2880 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renewthread()
2897 dp = TAILQ_LAST(&clp->nfsc_deleg, nfscldeleghead); in nfscl_renewthread()
2898 while (clp->nfsc_delegcnt > clp->nfsc_deleghighwater && in nfscl_renewthread()
2923 TAILQ_REMOVE(&clp->nfsc_deleg, dp, nfsdl_list); in nfscl_renewthread()
2926 clp->nfsc_delegcnt--; in nfscl_renewthread()
2933 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renewthread()
2941 TAILQ_FOREACH_SAFE(lyp, &clp->nfsc_layout, nfsly_list, nlyp) { in nfscl_renewthread()
2959 TAILQ_REMOVE(&clp->nfsc_layout, lyp, in nfscl_renewthread()
2965 if (!NFSHASNOLAYOUTCOMMIT(clp->nfsc_nmp) && in nfscl_renewthread()
2970 nfscl_dolayoutcommit(clp->nfsc_nmp, lyp, in nfscl_renewthread()
2979 lyp = TAILQ_LAST(&clp->nfsc_layout, nfscllayouthead); in nfscl_renewthread()
2983 clp->nfsc_layoutcnt > clp->nfsc_layouthighwater) && in nfscl_renewthread()
2989 clp->nfsc_layoutcnt); in nfscl_renewthread()
3005 LIST_FOREACH_SAFE(dip, &clp->nfsc_devinfo, nfsdi_list, ndip) { in nfscl_renewthread()
3019 nfscl_layoutreturn(clp->nfsc_nmp, lyp, cred, p); in nfscl_renewthread()
3034 (void) nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p); in nfscl_renewthread()
3047 nfscl_cleanupkext(clp, &lfh); in nfscl_renewthread()
3059 (void)nfsrpc_rellockown(clp->nfsc_nmp, lp, in nfscl_renewthread()
3069 if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) in nfscl_renewthread()
3070 (void)mtx_sleep(clp, NFSCLSTATEMUTEXPTR, PWAIT, "nfscl", in nfscl_renewthread()
3073 if (clp->nfsc_flags & NFSCLFLAGS_UMOUNT) { in nfscl_renewthread()
3074 clp->nfsc_flags &= ~NFSCLFLAGS_HASTHREAD; in nfscl_renewthread()
3077 wakeup((caddr_t)clp); in nfscl_renewthread()
3089 nfscl_initiate_recovery(struct nfsclclient *clp) in nfscl_initiate_recovery() argument
3092 if (clp == NULL) in nfscl_initiate_recovery()
3095 clp->nfsc_flags |= NFSCLFLAGS_RECOVER; in nfscl_initiate_recovery()
3097 wakeup((caddr_t)clp); in nfscl_initiate_recovery()
3107 struct nfsclclient *clp; in nfscl_dumpstate() local
3114 clp = nmp->nm_clp; in nfscl_dumpstate()
3115 if (clp == NULL) { in nfscl_dumpstate()
3120 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { in nfscl_dumpstate()
3157 LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { in nfscl_dumpstate()
3202 struct nfsclclient *clp; in nfscl_dupopen() local
3207 clp = VFSTONFS(vp->v_mount)->nm_clp; in nfscl_dupopen()
3208 if (clp == NULL) { in nfscl_dupopen()
3219 LIST_FOREACH(owp2, &clp->nfsc_owner, nfsow_list) { in nfscl_dupopen()
3220 LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { in nfscl_dupopen()
3236 LIST_FOREACH(owp2, &clp->nfsc_owner, nfsow_list) { in nfscl_dupopen()
3238 LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { in nfscl_dupopen()
3264 LIST_FOREACH(owp2, &clp->nfsc_owner, nfsow_list) { in nfscl_dupopen()
3268 LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { in nfscl_dupopen()
3310 struct nfsclclient *clp; in nfscl_getclose() local
3317 error = nfscl_getcl(vp->v_mount, NULL, NULL, false, true, &clp); in nfscl_getclose()
3320 *clpp = clp; in nfscl_getclose()
3333 dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); in nfscl_getclose()
3355 LIST_FOREACH(op, NFSCLOPENHASH(clp, nfhp->nfh_fh, nfhp->nfh_len), in nfscl_getclose()
3383 struct nfsclclient *clp; in nfscl_doclose() local
3394 error = nfscl_getcl(vp->v_mount, NULL, NULL, false, true, &clp); in nfscl_doclose()
3397 *clpp = clp; in nfscl_doclose()
3407 dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); in nfscl_doclose()
3421 nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp, in nfscl_doclose()
3427 LIST_FOREACH(op, NFSCLOPENHASH(clp, nfhp->nfh_fh, nfhp->nfh_len), in nfscl_doclose()
3452 nfscl_clrelease(clp); in nfscl_doclose()
3488 nfscl_delegreturnall(struct nfsclclient *clp, NFSPROC_T *p, in nfscl_delegreturnall() argument
3495 TAILQ_FOREACH_SAFE(dp, &clp->nfsc_deleg, nfsdl_list, ndp) { in nfscl_delegreturnall()
3497 (void) nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p); in nfscl_delegreturnall()
3499 nfscl_freedeleg(&clp->nfsc_deleg, dp, false); in nfscl_delegreturnall()
3502 nfscl_freedeleg(&clp->nfsc_deleg, dp, true); in nfscl_delegreturnall()
3513 struct nfsclclient *clp; in nfscl_delegreturnvp() local
3530 clp = nmp->nm_clp; in nfscl_delegreturnvp()
3531 if (clp != NULL) in nfscl_delegreturnvp()
3532 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, in nfscl_delegreturnvp()
3537 nfscl_freedeleg(&clp->nfsc_deleg, dp, false); in nfscl_delegreturnvp()
3541 nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p); in nfscl_delegreturnvp()
3557 struct nfsclclient *clp; in nfscl_docb() local
3655 &clp); in nfscl_docb()
3668 dp = nfscl_finddeleg(clp, nfhp->nfh_fh, in nfscl_docb()
3719 clp = nfscl_getclnt(cbident); in nfscl_docb()
3721 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3722 if (clp != NULL) in nfscl_docb()
3723 nfscl_startdelegrecall(clp, nfhp); in nfscl_docb()
3767 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3768 NFSCL_DEBUG(4, "cbly clp=%p\n", clp); in nfscl_docb()
3769 if (clp != NULL) { in nfscl_docb()
3770 lyp = nfscl_findlayout(clp, in nfscl_docb()
3795 wakeup(clp); in nfscl_docb()
3815 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3816 if (clp != NULL) { in nfscl_docb()
3817 TAILQ_FOREACH(lyp, &clp->nfsc_layout, in nfscl_docb()
3836 wakeup(clp); in nfscl_docb()
3845 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3846 if (clp != NULL) { in nfscl_docb()
3847 TAILQ_FOREACH(lyp, &clp->nfsc_layout, in nfscl_docb()
3858 wakeup(clp); in nfscl_docb()
3897 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3898 if (clp == NULL) in nfscl_docb()
3901 tsep = nfsmnt_mdssession(clp->nfsc_nmp); in nfscl_docb()
3939 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3940 if (clp == NULL) in nfscl_docb()
3943 tsep = nfsmnt_mdssession(clp->nfsc_nmp); in nfscl_docb()
3967 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
3968 if (clp == NULL) in nfscl_docb()
3973 clp->nfsc_deleghighwater) in nfscl_docb()
3974 clp->nfsc_deleghighwater = i; in nfscl_docb()
3976 ((!NFSHASFLEXFILE(clp->nfsc_nmp) && in nfscl_docb()
3978 i < clp->nfsc_layouthighwater) || in nfscl_docb()
3979 (NFSHASFLEXFILE(clp->nfsc_nmp) && in nfscl_docb()
3982 i < clp->nfsc_layouthighwater))) in nfscl_docb()
3983 clp->nfsc_layouthighwater = i; in nfscl_docb()
4051 clp = nfscl_getclntsess(sessionid); in nfscl_docb()
4052 if (clp != NULL) { in nfscl_docb()
4053 tsep = nfsmnt_mdssession(clp->nfsc_nmp); in nfscl_docb()
4071 struct nfsclclient *clp; in nfscl_nextcbident() local
4086 LIST_FOREACH(clp, &nfsclhead, nfsc_list) { in nfscl_nextcbident()
4087 if (clp->nfsc_cbident == nextcbident) { in nfscl_nextcbident()
4107 struct nfsclclient *clp; in nfscl_getmnt() local
4114 LIST_FOREACH(clp, &nfsclhead, nfsc_list) { in nfscl_getmnt()
4115 tsep = nfsmnt_mdssession(clp->nfsc_nmp); in nfscl_getmnt()
4117 if (clp->nfsc_cbident == cbident) in nfscl_getmnt()
4123 if (clp == NULL) { in nfscl_getmnt()
4127 mp = clp->nfsc_nmp->nm_mountp; in nfscl_getmnt()
4134 *clpp = clp; in nfscl_getmnt()
4144 struct nfsclclient *clp; in nfscl_getclnt() local
4146 LIST_FOREACH(clp, &nfsclhead, nfsc_list) in nfscl_getclnt()
4147 if (clp->nfsc_cbident == cbident) in nfscl_getclnt()
4149 return (clp); in nfscl_getclnt()
4158 struct nfsclclient *clp; in nfscl_getclntsess() local
4161 LIST_FOREACH(clp, &nfsclhead, nfsc_list) { in nfscl_getclntsess()
4162 tsep = nfsmnt_mdssession(clp->nfsc_nmp); in nfscl_getclntsess()
4167 return (clp); in nfscl_getclntsess()
4176 nfscl_localconflict(struct nfsclclient *clp, u_int8_t *fhp, int fhlen, in nfscl_localconflict() argument
4188 LIST_FOREACH(op, NFSCLOPENHASH(clp, fhp, fhlen), nfso_hash) { in nfscl_localconflict()
4231 nfscl_lockt(vnode_t vp, struct nfsclclient *clp, u_int64_t off, in nfscl_lockt() argument
4252 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_lockt()
4253 error = nfscl_localconflict(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len, in nfscl_lockt()
4284 nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp, in nfscl_recalldeleg() argument
4353 LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { in nfscl_recalldeleg()
4357 ret = nfscl_moveopen(vp, clp, nmp, lop, in nfscl_recalldeleg()
4380 nfscl_newopen(clp, NULL, &owp, &nowp, &op, in nfscl_recalldeleg()
4384 ret = nfscl_moveopen(vp, clp, nmp, lop, in nfscl_recalldeleg()
4408 ret = nfscl_relock(vp, clp, nmp, lp, lckp, cred, p); in nfscl_recalldeleg()
4427 nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, in nfscl_moveopen() argument
4456 nfscl_newopen(clp, NULL, &owp, NULL, &op, &nop, owp->nfsow_owner, in nfscl_moveopen()
4494 nfscl_totalrecall(struct nfsclclient *clp) in nfscl_totalrecall() argument
4498 TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { in nfscl_totalrecall()
4508 nfscl_relock(vnode_t vp, struct nfsclclient *clp, struct nfsmount *nmp, in nfscl_relock() argument
4528 clp, 1, NULL, lp->nfsl_lockflags, lp->nfsl_owner, in nfscl_relock()
4713 struct nfsclclient *clp; in nfscl_mustflush() local
4729 clp = nfscl_findcl(nmp); in nfscl_mustflush()
4730 if (clp == NULL) { in nfscl_mustflush()
4734 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_mustflush()
4753 struct nfsclclient *clp; in nfscl_nodeleg() local
4769 clp = nfscl_findcl(nmp); in nfscl_nodeleg()
4770 if (clp == NULL) { in nfscl_nodeleg()
4774 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_nodeleg()
4792 struct nfsclclient *clp; in nfscl_removedeleg() local
4822 clp = nfscl_findcl(nmp); in nfscl_removedeleg()
4823 if (clp == NULL) { in nfscl_removedeleg()
4827 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, in nfscl_removedeleg()
4835 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_removedeleg()
4867 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, in nfscl_removedeleg()
4872 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_removedeleg()
4884 nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0, NULL); in nfscl_removedeleg()
4888 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_removedeleg()
4895 nfscl_freedeleg(&clp->nfsc_deleg, dp, true); in nfscl_removedeleg()
4898 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_removedeleg()
4911 struct nfsclclient *clp; in nfscl_renamedeleg() local
4942 clp = nfscl_findcl(nmp); in nfscl_renamedeleg()
4943 if (clp == NULL) { in nfscl_renamedeleg()
4948 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, in nfscl_renamedeleg()
4956 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renamedeleg()
4990 igotlock = nfsv4_lock(&clp->nfsc_lock, 1, in nfscl_renamedeleg()
4995 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renamedeleg()
5009 nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0, NULL); in nfscl_renamedeleg()
5013 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renamedeleg()
5021 nfscl_freedeleg(&clp->nfsc_deleg, dp, true); in nfscl_renamedeleg()
5024 nfsv4_unlock(&clp->nfsc_lock, 0); in nfscl_renamedeleg()
5029 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, in nfscl_renamedeleg()
5063 nfscl_freedeleg(&clp->nfsc_deleg, dp, true); in nfscl_renamedeleg()
5078 struct nfsclclient *clp; in nfscl_getref() local
5082 clp = nfscl_findcl(nmp); in nfscl_getref()
5083 if (clp == NULL) { in nfscl_getref()
5087 nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, nmp->nm_mountp); in nfscl_getref()
5101 struct nfsclclient *clp; in nfscl_relref() local
5104 clp = nfscl_findcl(nmp); in nfscl_relref()
5105 if (clp == NULL) { in nfscl_relref()
5109 nfsv4_relref(&clp->nfsc_lock); in nfscl_relref()
5120 struct nfsclclient *clp; in nfscl_reclaimnode() local
5129 clp = nfscl_findcl(nmp); in nfscl_reclaimnode()
5130 if (clp == NULL) { in nfscl_reclaimnode()
5134 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_reclaimnode()
5147 struct nfsclclient *clp; in nfscl_newnode() local
5156 clp = nfscl_findcl(nmp); in nfscl_newnode()
5157 if (clp == NULL) { in nfscl_newnode()
5161 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_newnode()
5174 struct nfsclclient *clp; in nfscl_delegmodtime() local
5189 clp = nfscl_findcl(nmp); in nfscl_delegmodtime()
5190 if (clp == NULL) { in nfscl_delegmodtime()
5194 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_delegmodtime()
5212 struct nfsclclient *clp; in nfscl_deleggetmodtime() local
5227 clp = nfscl_findcl(nmp); in nfscl_deleggetmodtime()
5228 if (clp == NULL) { in nfscl_deleggetmodtime()
5232 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_deleggetmodtime()
5282 struct nfsclclient *clp; in nfscl_layout() local
5300 clp = nmp->nm_clp; in nfscl_layout()
5301 if (clp == NULL) { in nfscl_layout()
5315 lyp = nfscl_findlayout(clp, fhp, fhlen); in nfscl_layout()
5329 lyp->nfsly_clp = clp; in nfscl_layout()
5338 TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); in nfscl_layout()
5339 LIST_INSERT_HEAD(NFSCLLAYOUTHASH(clp, fhp, fhlen), lyp, in nfscl_layout()
5342 clp->nfsc_layoutcnt++; in nfscl_layout()
5349 TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); in nfscl_layout()
5350 TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); in nfscl_layout()
5387 nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, int fhlen, in nfscl_getlayout() argument
5395 mp = clp->nfsc_nmp->nm_mountp; in nfscl_getlayout()
5399 lyp = nfscl_findlayout(clp, fhp, fhlen); in nfscl_getlayout()
5402 TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); in nfscl_getlayout()
5403 TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); in nfscl_getlayout()
5435 nfscl_retoncloselayout(vnode_t vp, struct nfsclclient *clp, uint8_t *fhp, in nfscl_retoncloselayout() argument
5446 lyp = nfscl_findlayout(clp, fhp, fhlen); in nfscl_retoncloselayout()
5462 wakeup(clp); in nfscl_retoncloselayout()
5553 nfscl_getdevinfo(struct nfsclclient *clp, uint8_t *deviceid, in nfscl_getdevinfo() argument
5559 dip = nfscl_finddevinfo(clp, deviceid); in nfscl_getdevinfo()
5594 nfscl_findlayout(struct nfsclclient *clp, u_int8_t *fhp, int fhlen) in nfscl_findlayout() argument
5598 LIST_FOREACH(lyp, NFSCLLAYOUTHASH(clp, fhp, fhlen), nfsly_hash) in nfscl_findlayout()
5609 nfscl_finddevinfo(struct nfsclclient *clp, uint8_t *deviceid) in nfscl_finddevinfo() argument
5613 LIST_FOREACH(dip, &clp->nfsc_devinfo, nfsdi_list) in nfscl_finddevinfo()
5653 struct nfsclclient *clp; in nfscl_adddevinfo() local
5658 clp = nmp->nm_clp; in nfscl_adddevinfo()
5659 if (clp == NULL) { in nfscl_adddevinfo()
5669 tdip = nfscl_finddevinfo(clp, dev); in nfscl_adddevinfo()
5683 LIST_INSERT_HEAD(&clp->nfsc_devinfo, dip, nfsdi_list); in nfscl_adddevinfo()
5916 struct nfsclclient *clp; in nfscl_layoutcommit() local
5927 clp = nmp->nm_clp; in nfscl_layoutcommit()
5928 if (clp == NULL) { in nfscl_layoutcommit()
5932 lyp = nfscl_findlayout(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_layoutcommit()
5947 nfscl_dolayoutcommit(clp->nfsc_nmp, lyp, NFSPROCCRED(p), p); in nfscl_layoutcommit()
5963 struct nfsclclient *clp; in nfscl_delegacecheck() local
5982 clp = nfscl_findcl(nmp); in nfscl_delegacecheck()
5983 if (clp == NULL) { in nfscl_delegacecheck()
5988 dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); in nfscl_delegacecheck()
6011 void nfscl_startdelegrecall(struct nfsclclient *clp, struct nfsfh *nfhp) in nfscl_startdelegrecall() argument
6015 dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); in nfscl_startdelegrecall()
6018 wakeup((caddr_t)clp); in nfscl_startdelegrecall()