Lines Matching refs:hostp

347 	struct nlm_host *hostp;  in nlm_gc()  local
373 for (hostp = avl_first(&g->nlm_hosts_tree); hostp != NULL; in nlm_gc()
374 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp)) { in nlm_gc()
377 mutex_enter(&hostp->nh_lock); in nlm_gc()
379 nvp = TAILQ_FIRST(&hostp->nh_vholds_list); in nlm_gc()
398 nlm_vhold_destroy(hostp, nvp); in nlm_gc()
404 mutex_exit(&hostp->nh_lock); in nlm_gc()
411 while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) { in nlm_gc()
414 if (hostp->nh_idle_timeout > now) in nlm_gc()
424 mutex_enter(&hostp->nh_lock); in nlm_gc()
431 nlm_host_gc_vholds(hostp); in nlm_gc()
432 has_locks = nlm_host_has_locks(hostp); in nlm_gc()
434 mutex_exit(&hostp->nh_lock); in nlm_gc()
446 if ((hostp->nh_flags & NLM_NH_INIDLE) == 0 || in nlm_gc()
447 hostp->nh_idle_timeout > now) in nlm_gc()
457 hostp, nh_link); in nlm_gc()
458 hostp->nh_idle_timeout = now + idle_period; in nlm_gc()
460 hostp, nh_link); in nlm_gc()
473 nlm_host_unregister(g, hostp); in nlm_gc()
476 nlm_host_unmonitor(g, hostp); in nlm_gc()
477 nlm_host_destroy(hostp); in nlm_gc()
502 nlm_reclaimer(struct nlm_host *hostp) in nlm_reclaimer() argument
506 mutex_enter(&hostp->nh_lock); in nlm_reclaimer()
507 hostp->nh_reclaimer = curthread; in nlm_reclaimer()
508 mutex_exit(&hostp->nh_lock); in nlm_reclaimer()
511 nlm_reclaim_client(g, hostp); in nlm_reclaimer()
513 mutex_enter(&hostp->nh_lock); in nlm_reclaimer()
514 hostp->nh_flags &= ~NLM_NH_RECLAIM; in nlm_reclaimer()
515 hostp->nh_reclaimer = NULL; in nlm_reclaimer()
516 cv_broadcast(&hostp->nh_recl_cv); in nlm_reclaimer()
517 mutex_exit(&hostp->nh_lock); in nlm_reclaimer()
524 nlm_host_release(g, hostp); in nlm_reclaimer()
603 struct nlm_host *hostp; in nlm_suspend_zone() local
619 for (hostp = avl_first(&g->nlm_hosts_tree); hostp != NULL; in nlm_suspend_zone()
620 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp)) { in nlm_suspend_zone()
626 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_suspend_zone()
627 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_suspend_zone()
628 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_suspend_zone()
631 hostp->nh_refs++; in nlm_suspend_zone()
632 TAILQ_INSERT_TAIL(&all_hosts, hostp, nh_link); in nlm_suspend_zone()
642 while ((hostp = TAILQ_FIRST(&all_hosts)) != NULL) { in nlm_suspend_zone()
643 mutex_enter(&hostp->nh_lock); in nlm_suspend_zone()
644 if (nlm_host_has_locks(hostp)) in nlm_suspend_zone()
645 hostp->nh_flags |= NLM_NH_SUSPEND; in nlm_suspend_zone()
647 mutex_exit(&hostp->nh_lock); in nlm_suspend_zone()
648 TAILQ_REMOVE(&all_hosts, hostp, nh_link); in nlm_suspend_zone()
665 struct nlm_host *hostp, *h_next; in nlm_resume_zone() local
668 hostp = avl_first(&g->nlm_hosts_tree); in nlm_resume_zone()
676 while (hostp != NULL) { in nlm_resume_zone()
683 h_next = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_resume_zone()
686 DTRACE_PROBE1(resume__host, struct nlm_host *, hostp); in nlm_resume_zone()
692 if (!(hostp->nh_flags & NLM_NH_SUSPEND)) in nlm_resume_zone()
695 error = nlm_nsm_init(&nsm, &hostp->nh_knc, &hostp->nh_addr); in nlm_resume_zone()
698 "[error=%d]\n", hostp->nh_name, error); in nlm_resume_zone()
706 "host %s [stat=%d]\n", hostp->nh_name, stat); in nlm_resume_zone()
712 if (sm_state != hostp->nh_state) { in nlm_resume_zone()
721 nlm_host_notify_client(hostp, sm_state); in nlm_resume_zone()
722 nlm_host_notify_server(hostp, sm_state); in nlm_resume_zone()
733 nlm_host_notify_server(hostp, 0); in nlm_resume_zone()
734 nlm_client_cancel_all(g, hostp); in nlm_resume_zone()
737 hostp->nh_flags &= ~NLM_NH_SUSPEND; in nlm_resume_zone()
738 nlm_host_release(g, hostp); in nlm_resume_zone()
739 hostp = h_next; in nlm_resume_zone()
1003 nlm_vhold_get(struct nlm_host *hostp, vnode_t *vp) in nlm_vhold_get() argument
1007 mutex_enter(&hostp->nh_lock); in nlm_vhold_get()
1008 nvp = nlm_vhold_find_locked(hostp, vp); in nlm_vhold_get()
1013 mutex_exit(&hostp->nh_lock); in nlm_vhold_get()
1020 mutex_enter(&hostp->nh_lock); in nlm_vhold_get()
1021 nvp = nlm_vhold_find_locked(hostp, vp); in nlm_vhold_get()
1031 VERIFY(mod_hash_insert(hostp->nh_vholds_by_vp, in nlm_vhold_get()
1033 TAILQ_INSERT_TAIL(&hostp->nh_vholds_list, nvp, nv_link); in nlm_vhold_get()
1037 mutex_exit(&hostp->nh_lock); in nlm_vhold_get()
1048 nlm_vhold_release(struct nlm_host *hostp, struct nlm_vhold *nvp) in nlm_vhold_release() argument
1053 mutex_enter(&hostp->nh_lock); in nlm_vhold_release()
1067 nlm_vhold_destroy(hostp, nvp); in nlm_vhold_release()
1070 mutex_exit(&hostp->nh_lock); in nlm_vhold_release()
1086 nlm_vhold_destroy(struct nlm_host *hostp, struct nlm_vhold *nvp) in nlm_vhold_destroy() argument
1088 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_vhold_destroy()
1093 VERIFY(mod_hash_remove(hostp->nh_vholds_by_vp, in nlm_vhold_destroy()
1097 TAILQ_REMOVE(&hostp->nh_vholds_list, nvp, nv_link); in nlm_vhold_destroy()
1113 nlm_vhold_busy(struct nlm_host *hostp, struct nlm_vhold *nvp) in nlm_vhold_busy() argument
1118 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_vhold_busy()
1124 sysid = hostp->nh_sysid; in nlm_vhold_busy()
1154 nlm_vhold_find_locked(struct nlm_host *hostp, const vnode_t *vp) in nlm_vhold_find_locked() argument
1158 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_vhold_find_locked()
1159 (void) mod_hash_find(hostp->nh_vholds_by_vp, in nlm_vhold_find_locked()
1187 struct nlm_host *hostp = (struct nlm_host *)datap; in nlm_host_ctor() local
1189 bzero(hostp, sizeof (*hostp)); in nlm_host_ctor()
1197 struct nlm_host *hostp = (struct nlm_host *)datap; in nlm_host_dtor() local
1198 ASSERT(hostp->nh_refs == 0); in nlm_host_dtor()
1202 nlm_host_unregister(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_unregister() argument
1204 ASSERT(hostp->nh_refs == 0); in nlm_host_unregister()
1205 ASSERT(hostp->nh_flags & NLM_NH_INIDLE); in nlm_host_unregister()
1207 avl_remove(&g->nlm_hosts_tree, hostp); in nlm_host_unregister()
1209 (mod_hash_key_t)(uintptr_t)hostp->nh_sysid, in nlm_host_unregister()
1210 (mod_hash_val_t)&hostp) == 0); in nlm_host_unregister()
1211 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_unregister()
1212 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_host_unregister()
1220 nlm_host_destroy(struct nlm_host *hostp) in nlm_host_destroy() argument
1222 ASSERT(hostp->nh_name != NULL); in nlm_host_destroy()
1223 ASSERT(hostp->nh_netid != NULL); in nlm_host_destroy()
1224 ASSERT(TAILQ_EMPTY(&hostp->nh_vholds_list)); in nlm_host_destroy()
1226 strfree(hostp->nh_name); in nlm_host_destroy()
1227 strfree(hostp->nh_netid); in nlm_host_destroy()
1228 kmem_free(hostp->nh_addr.buf, hostp->nh_addr.maxlen); in nlm_host_destroy()
1230 if (hostp->nh_sysid != LM_NOSYSID) in nlm_host_destroy()
1231 nlm_sysid_free(hostp->nh_sysid); in nlm_host_destroy()
1233 nlm_rpc_cache_destroy(hostp); in nlm_host_destroy()
1235 ASSERT(TAILQ_EMPTY(&hostp->nh_vholds_list)); in nlm_host_destroy()
1236 mod_hash_destroy_ptrhash(hostp->nh_vholds_by_vp); in nlm_host_destroy()
1238 mutex_destroy(&hostp->nh_lock); in nlm_host_destroy()
1239 cv_destroy(&hostp->nh_rpcb_cv); in nlm_host_destroy()
1240 cv_destroy(&hostp->nh_recl_cv); in nlm_host_destroy()
1242 kmem_cache_free(nlm_hosts_cache, hostp); in nlm_host_destroy()
1261 nlm_host_notify_server(struct nlm_host *hostp, int32_t state) in nlm_host_notify_server() argument
1268 mutex_enter(&hostp->nh_lock); in nlm_host_notify_server()
1270 hostp->nh_state = state; in nlm_host_notify_server()
1272 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) { in nlm_host_notify_server()
1288 mutex_exit(&hostp->nh_lock); in nlm_host_notify_server()
1290 nlm_vhold_clean(nvp, hostp->nh_sysid); in nlm_host_notify_server()
1292 mutex_enter(&hostp->nh_lock); in nlm_host_notify_server()
1296 mutex_exit(&hostp->nh_lock); in nlm_host_notify_server()
1317 nlm_host_notify_client(struct nlm_host *hostp, int32_t state) in nlm_host_notify_client() argument
1319 mutex_enter(&hostp->nh_lock); in nlm_host_notify_client()
1320 hostp->nh_state = state; in nlm_host_notify_client()
1321 if (hostp->nh_flags & NLM_NH_RECLAIM) { in nlm_host_notify_client()
1326 mutex_exit(&hostp->nh_lock); in nlm_host_notify_client()
1330 hostp->nh_flags |= NLM_NH_RECLAIM; in nlm_host_notify_client()
1336 hostp->nh_refs++; in nlm_host_notify_client()
1337 mutex_exit(&hostp->nh_lock); in nlm_host_notify_client()
1340 hostp, 0, minclsyspri); in nlm_host_notify_client()
1350 nlm_host_wait_grace(struct nlm_host *hostp) in nlm_host_wait_grace() argument
1356 mutex_enter(&hostp->nh_lock); in nlm_host_wait_grace()
1361 rc = cv_timedwait_sig(&hostp->nh_recl_cv, in nlm_host_wait_grace()
1362 &hostp->nh_lock, ddi_get_lbolt() + in nlm_host_wait_grace()
1369 } while (hostp->nh_flags & NLM_NH_RECLAIM); in nlm_host_wait_grace()
1371 mutex_exit(&hostp->nh_lock); in nlm_host_wait_grace()
1419 nlm_host_cancel_slocks(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_cancel_slocks() argument
1425 if (nslp->nsl_host == hostp) { in nlm_host_cancel_slocks()
1443 nlm_host_gc_vholds(struct nlm_host *hostp) in nlm_host_gc_vholds() argument
1447 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_host_gc_vholds()
1449 nvp = TAILQ_FIRST(&hostp->nh_vholds_list); in nlm_host_gc_vholds()
1453 if (nlm_vhold_busy(hostp, nvp)) { in nlm_host_gc_vholds()
1459 nlm_vhold_destroy(hostp, nvp); in nlm_host_gc_vholds()
1469 nlm_host_has_srv_locks(struct nlm_host *hostp) in nlm_host_has_srv_locks() argument
1482 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_host_has_srv_locks()
1483 if (!TAILQ_EMPTY(&hostp->nh_vholds_list)) in nlm_host_has_srv_locks()
1494 nlm_host_has_cli_locks(struct nlm_host *hostp) in nlm_host_has_cli_locks() argument
1496 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_host_has_cli_locks()
1517 if (flk_sysid_has_locks(hostp->nh_sysid | in nlm_host_has_cli_locks()
1525 if (hostp->nh_shrlist != NULL) in nlm_host_has_cli_locks()
1536 nlm_host_has_locks(struct nlm_host *hostp) in nlm_host_has_locks() argument
1538 if (nlm_host_has_srv_locks(hostp)) in nlm_host_has_locks()
1541 return (nlm_host_has_cli_locks(hostp)); in nlm_host_has_locks()
1621 struct nlm_host *hostp, key; in nlm_host_find_locked() local
1631 hostp = avl_find(&g->nlm_hosts_tree, &key, &pos); in nlm_host_find_locked()
1633 if (hostp != NULL) { in nlm_host_find_locked()
1638 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_host_find_locked()
1639 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_find_locked()
1640 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_host_find_locked()
1643 hostp->nh_refs++; in nlm_host_find_locked()
1648 return (hostp); in nlm_host_find_locked()
1658 struct nlm_host *hostp = NULL; in nlm_host_find() local
1664 hostp = nlm_host_find_locked(g, netid, addr, NULL); in nlm_host_find()
1668 return (hostp); in nlm_host_find()
1757 struct nlm_host *hostp = NULL; in nlm_host_find_by_sysid() local
1765 (mod_hash_val_t)&hostp); in nlm_host_find_by_sysid()
1767 if (hostp == NULL) in nlm_host_find_by_sysid()
1774 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_host_find_by_sysid()
1775 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_find_by_sysid()
1776 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_host_find_by_sysid()
1779 hostp->nh_refs++; in nlm_host_find_by_sysid()
1783 return (hostp); in nlm_host_find_by_sysid()
1800 nlm_host_release_locked(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_release_locked() argument
1802 if (hostp == NULL) in nlm_host_release_locked()
1806 ASSERT(hostp->nh_refs > 0); in nlm_host_release_locked()
1808 hostp->nh_refs--; in nlm_host_release_locked()
1809 if (hostp->nh_refs != 0) in nlm_host_release_locked()
1817 hostp->nh_idle_timeout = ddi_get_lbolt() + in nlm_host_release_locked()
1820 ASSERT((hostp->nh_flags & NLM_NH_INIDLE) == 0); in nlm_host_release_locked()
1821 TAILQ_INSERT_TAIL(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_release_locked()
1822 hostp->nh_flags |= NLM_NH_INIDLE; in nlm_host_release_locked()
1826 nlm_host_release(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_release() argument
1828 if (hostp == NULL) in nlm_host_release()
1832 nlm_host_release_locked(g, hostp); in nlm_host_release()
1923 nlm_host_get_state(struct nlm_host *hostp) in nlm_host_get_state() argument
1926 return (hostp->nh_state); in nlm_host_get_state()
2056 struct nlm_host *hostp, struct nlm4_lock *alock) in nlm_slock_grant() argument
2064 (nslp->nsl_host != hostp)) in nlm_slock_grant()
2092 nlm_slreq_register(struct nlm_host *hostp, struct nlm_vhold *nvp, in nlm_slreq_register() argument
2098 mutex_enter(&hostp->nh_lock); in nlm_slreq_register()
2099 slr = nlm_slreq_find_locked(hostp, nvp, flp); in nlm_slreq_register()
2103 mutex_exit(&hostp->nh_lock); in nlm_slreq_register()
2107 mutex_enter(&hostp->nh_lock); in nlm_slreq_register()
2108 slr = nlm_slreq_find_locked(hostp, nvp, flp); in nlm_slreq_register()
2118 mutex_exit(&hostp->nh_lock); in nlm_slreq_register()
2133 nlm_slreq_unregister(struct nlm_host *hostp, struct nlm_vhold *nvp, in nlm_slreq_unregister() argument
2138 mutex_enter(&hostp->nh_lock); in nlm_slreq_unregister()
2139 slr = nlm_slreq_find_locked(hostp, nvp, flp); in nlm_slreq_unregister()
2141 mutex_exit(&hostp->nh_lock); in nlm_slreq_unregister()
2146 mutex_exit(&hostp->nh_lock); in nlm_slreq_unregister()
2156 nlm_slreq_find_locked(struct nlm_host *hostp, struct nlm_vhold *nvp, in nlm_slreq_find_locked() argument
2161 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_slreq_find_locked()
2190 nlm_shres_track(struct nlm_host *hostp, vnode_t *vp, struct shrlock *shrp) in nlm_shres_track() argument
2201 mutex_enter(&hostp->nh_lock); in nlm_shres_track()
2202 for (nsp = hostp->nh_shrlist; nsp != NULL; nsp = nsp->ns_next) in nlm_shres_track()
2216 nsp->ns_next = hostp->nh_shrlist; in nlm_shres_track()
2217 hostp->nh_shrlist = nsp; in nlm_shres_track()
2220 mutex_exit(&hostp->nh_lock); in nlm_shres_track()
2226 nlm_shres_untrack(struct nlm_host *hostp, vnode_t *vp, struct shrlock *shrp) in nlm_shres_untrack() argument
2230 mutex_enter(&hostp->nh_lock); in nlm_shres_untrack()
2231 nsp = hostp->nh_shrlist; in nlm_shres_untrack()
2241 hostp->nh_shrlist = nsp; in nlm_shres_untrack()
2251 mutex_exit(&hostp->nh_lock); in nlm_shres_untrack()
2261 nlm_get_active_shres(struct nlm_host *hostp) in nlm_get_active_shres() argument
2265 mutex_enter(&hostp->nh_lock); in nlm_get_active_shres()
2266 for (nsp = hostp->nh_shrlist; nsp != NULL; nsp = nsp->ns_next) { in nlm_get_active_shres()
2274 mutex_exit(&hostp->nh_lock); in nlm_get_active_shres()
2466 struct nlm_host *hostp; in nlm_svc_stopping() local
2473 hostp = avl_first(&g->nlm_hosts_tree); in nlm_svc_stopping()
2474 while (hostp != NULL) { in nlm_svc_stopping()
2476 nlm_client_cancel_all(g, hostp); in nlm_svc_stopping()
2477 nlm_host_notify_server(hostp, 0); in nlm_svc_stopping()
2479 mutex_enter(&hostp->nh_lock); in nlm_svc_stopping()
2480 nlm_host_gc_vholds(hostp); in nlm_svc_stopping()
2481 if (hostp->nh_refs > 0 || nlm_host_has_locks(hostp)) { in nlm_svc_stopping()
2488 mutex_exit(&hostp->nh_lock); in nlm_svc_stopping()
2489 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_svc_stopping()
2494 mutex_exit(&hostp->nh_lock); in nlm_svc_stopping()
2495 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_svc_stopping()
2505 while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) { in nlm_svc_stopping()
2506 nlm_host_unregister(g, hostp); in nlm_svc_stopping()
2507 nlm_host_destroy(hostp); in nlm_svc_stopping()
2536 struct nlm_host *hostp; in nlm_vp_active() local
2548 hostp = avl_first(&g->nlm_hosts_tree); in nlm_vp_active()
2549 while (hostp != NULL) { in nlm_vp_active()
2550 mutex_enter(&hostp->nh_lock); in nlm_vp_active()
2551 nvp = nlm_vhold_find_locked(hostp, vp); in nlm_vp_active()
2552 mutex_exit(&hostp->nh_lock); in nlm_vp_active()
2558 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_vp_active()
2575 struct nlm_host *hostp; in nlm_zone_unexport() local
2584 hostp = avl_first(&g->nlm_hosts_tree); in nlm_zone_unexport()
2585 while (hostp != NULL) { in nlm_zone_unexport()
2588 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_zone_unexport()
2589 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_zone_unexport()
2590 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_zone_unexport()
2592 hostp->nh_refs++; in nlm_zone_unexport()
2596 mutex_enter(&hostp->nh_lock); in nlm_zone_unexport()
2597 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) { in nlm_zone_unexport()
2601 mutex_exit(&hostp->nh_lock); in nlm_zone_unexport()
2614 nlm_vhold_clean(nvp, hostp->nh_sysid); in nlm_zone_unexport()
2617 mutex_enter(&hostp->nh_lock); in nlm_zone_unexport()
2620 mutex_exit(&hostp->nh_lock); in nlm_zone_unexport()
2623 nlm_host_release_locked(g, hostp); in nlm_zone_unexport()
2625 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_zone_unexport()