Lines Matching refs:hostp
347 struct nlm_host *hostp; in nlm_gc() local
374 while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) { in nlm_gc()
377 if (hostp->nh_idle_timeout > now) in nlm_gc()
387 mutex_enter(&hostp->nh_lock); in nlm_gc()
394 nlm_host_gc_vholds(hostp); in nlm_gc()
395 has_locks = nlm_host_has_locks(hostp); in nlm_gc()
397 mutex_exit(&hostp->nh_lock); in nlm_gc()
409 if (hostp->nh_idle_timeout > now || hostp->nh_refs > 0) in nlm_gc()
419 hostp, nh_link); in nlm_gc()
420 hostp->nh_idle_timeout = now + idle_period; in nlm_gc()
422 hostp, nh_link); in nlm_gc()
435 nlm_host_unregister(g, hostp); in nlm_gc()
438 nlm_host_unmonitor(g, hostp); in nlm_gc()
439 nlm_host_destroy(hostp); in nlm_gc()
464 nlm_reclaimer(struct nlm_host *hostp) in nlm_reclaimer() argument
468 mutex_enter(&hostp->nh_lock); in nlm_reclaimer()
469 hostp->nh_reclaimer = curthread; in nlm_reclaimer()
470 mutex_exit(&hostp->nh_lock); in nlm_reclaimer()
473 nlm_reclaim_client(g, hostp); in nlm_reclaimer()
475 mutex_enter(&hostp->nh_lock); in nlm_reclaimer()
476 hostp->nh_flags &= ~NLM_NH_RECLAIM; in nlm_reclaimer()
477 hostp->nh_reclaimer = NULL; in nlm_reclaimer()
478 cv_broadcast(&hostp->nh_recl_cv); in nlm_reclaimer()
479 mutex_exit(&hostp->nh_lock); in nlm_reclaimer()
486 nlm_host_release(g, hostp); in nlm_reclaimer()
565 struct nlm_host *hostp; in nlm_suspend_zone() local
581 for (hostp = avl_first(&g->nlm_hosts_tree); hostp != NULL; in nlm_suspend_zone()
582 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp)) { in nlm_suspend_zone()
588 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_suspend_zone()
589 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_suspend_zone()
590 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_suspend_zone()
593 hostp->nh_refs++; in nlm_suspend_zone()
594 TAILQ_INSERT_TAIL(&all_hosts, hostp, nh_link); in nlm_suspend_zone()
604 while ((hostp = TAILQ_FIRST(&all_hosts)) != NULL) { in nlm_suspend_zone()
605 mutex_enter(&hostp->nh_lock); in nlm_suspend_zone()
606 if (nlm_host_has_locks(hostp)) in nlm_suspend_zone()
607 hostp->nh_flags |= NLM_NH_SUSPEND; in nlm_suspend_zone()
609 mutex_exit(&hostp->nh_lock); in nlm_suspend_zone()
610 TAILQ_REMOVE(&all_hosts, hostp, nh_link); in nlm_suspend_zone()
627 struct nlm_host *hostp, *h_next; in nlm_resume_zone() local
630 hostp = avl_first(&g->nlm_hosts_tree); in nlm_resume_zone()
638 while (hostp != NULL) { in nlm_resume_zone()
645 h_next = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_resume_zone()
648 DTRACE_PROBE1(resume__host, struct nlm_host *, hostp); in nlm_resume_zone()
654 if (!(hostp->nh_flags & NLM_NH_SUSPEND)) in nlm_resume_zone()
657 error = nlm_nsm_init(&nsm, &hostp->nh_knc, &hostp->nh_addr); in nlm_resume_zone()
660 "[error=%d]\n", hostp->nh_name, error); in nlm_resume_zone()
668 "host %s [stat=%d]\n", hostp->nh_name, stat); in nlm_resume_zone()
674 if (sm_state != hostp->nh_state) { in nlm_resume_zone()
683 nlm_host_notify_client(hostp, sm_state); in nlm_resume_zone()
684 nlm_host_notify_server(hostp, sm_state); in nlm_resume_zone()
695 nlm_host_notify_server(hostp, 0); in nlm_resume_zone()
696 nlm_client_cancel_all(g, hostp); in nlm_resume_zone()
699 hostp->nh_flags &= ~NLM_NH_SUSPEND; in nlm_resume_zone()
700 nlm_host_release(g, hostp); in nlm_resume_zone()
701 hostp = h_next; in nlm_resume_zone()
957 nlm_vhold_get(struct nlm_host *hostp, vnode_t *vp) in nlm_vhold_get() argument
961 mutex_enter(&hostp->nh_lock); in nlm_vhold_get()
962 nvp = nlm_vhold_find_locked(hostp, vp); in nlm_vhold_get()
967 mutex_exit(&hostp->nh_lock); in nlm_vhold_get()
974 mutex_enter(&hostp->nh_lock); in nlm_vhold_get()
975 nvp = nlm_vhold_find_locked(hostp, vp); in nlm_vhold_get()
985 VERIFY(mod_hash_insert(hostp->nh_vholds_by_vp, in nlm_vhold_get()
987 TAILQ_INSERT_TAIL(&hostp->nh_vholds_list, nvp, nv_link); in nlm_vhold_get()
991 mutex_exit(&hostp->nh_lock); in nlm_vhold_get()
1002 nlm_vhold_release(struct nlm_host *hostp, struct nlm_vhold *nvp) in nlm_vhold_release() argument
1007 mutex_enter(&hostp->nh_lock); in nlm_vhold_release()
1010 mutex_exit(&hostp->nh_lock); in nlm_vhold_release()
1026 nlm_vhold_destroy(struct nlm_host *hostp, struct nlm_vhold *nvp) in nlm_vhold_destroy() argument
1028 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_vhold_destroy()
1030 VERIFY(mod_hash_remove(hostp->nh_vholds_by_vp, in nlm_vhold_destroy()
1034 TAILQ_REMOVE(&hostp->nh_vholds_list, nvp, nv_link); in nlm_vhold_destroy()
1050 nlm_vhold_busy(struct nlm_host *hostp, struct nlm_vhold *nvp) in nlm_vhold_busy() argument
1055 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_vhold_busy()
1061 sysid = hostp->nh_sysid; in nlm_vhold_busy()
1091 nlm_vhold_find_locked(struct nlm_host *hostp, const vnode_t *vp) in nlm_vhold_find_locked() argument
1095 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_vhold_find_locked()
1096 (void) mod_hash_find(hostp->nh_vholds_by_vp, in nlm_vhold_find_locked()
1124 struct nlm_host *hostp = (struct nlm_host *)datap; in nlm_host_ctor() local
1126 bzero(hostp, sizeof (*hostp)); in nlm_host_ctor()
1134 struct nlm_host *hostp = (struct nlm_host *)datap; in nlm_host_dtor() local
1135 ASSERT(hostp->nh_refs == 0); in nlm_host_dtor()
1139 nlm_host_unregister(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_unregister() argument
1141 ASSERT(hostp->nh_refs == 0); in nlm_host_unregister()
1142 ASSERT(hostp->nh_flags & NLM_NH_INIDLE); in nlm_host_unregister()
1144 avl_remove(&g->nlm_hosts_tree, hostp); in nlm_host_unregister()
1146 (mod_hash_key_t)(uintptr_t)hostp->nh_sysid, in nlm_host_unregister()
1147 (mod_hash_val_t)&hostp) == 0); in nlm_host_unregister()
1148 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_unregister()
1149 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_host_unregister()
1157 nlm_host_destroy(struct nlm_host *hostp) in nlm_host_destroy() argument
1159 ASSERT(hostp->nh_name != NULL); in nlm_host_destroy()
1160 ASSERT(hostp->nh_netid != NULL); in nlm_host_destroy()
1161 ASSERT(TAILQ_EMPTY(&hostp->nh_vholds_list)); in nlm_host_destroy()
1163 strfree(hostp->nh_name); in nlm_host_destroy()
1164 strfree(hostp->nh_netid); in nlm_host_destroy()
1165 kmem_free(hostp->nh_addr.buf, hostp->nh_addr.maxlen); in nlm_host_destroy()
1167 if (hostp->nh_sysid != LM_NOSYSID) in nlm_host_destroy()
1168 nlm_sysid_free(hostp->nh_sysid); in nlm_host_destroy()
1170 nlm_rpc_cache_destroy(hostp); in nlm_host_destroy()
1172 ASSERT(TAILQ_EMPTY(&hostp->nh_vholds_list)); in nlm_host_destroy()
1173 mod_hash_destroy_ptrhash(hostp->nh_vholds_by_vp); in nlm_host_destroy()
1175 mutex_destroy(&hostp->nh_lock); in nlm_host_destroy()
1176 cv_destroy(&hostp->nh_rpcb_cv); in nlm_host_destroy()
1177 cv_destroy(&hostp->nh_recl_cv); in nlm_host_destroy()
1179 kmem_cache_free(nlm_hosts_cache, hostp); in nlm_host_destroy()
1198 nlm_host_notify_server(struct nlm_host *hostp, int32_t state) in nlm_host_notify_server() argument
1205 mutex_enter(&hostp->nh_lock); in nlm_host_notify_server()
1207 hostp->nh_state = state; in nlm_host_notify_server()
1209 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) { in nlm_host_notify_server()
1225 mutex_exit(&hostp->nh_lock); in nlm_host_notify_server()
1227 nlm_vhold_clean(nvp, hostp->nh_sysid); in nlm_host_notify_server()
1229 mutex_enter(&hostp->nh_lock); in nlm_host_notify_server()
1233 mutex_exit(&hostp->nh_lock); in nlm_host_notify_server()
1254 nlm_host_notify_client(struct nlm_host *hostp, int32_t state) in nlm_host_notify_client() argument
1256 mutex_enter(&hostp->nh_lock); in nlm_host_notify_client()
1257 hostp->nh_state = state; in nlm_host_notify_client()
1258 if (hostp->nh_flags & NLM_NH_RECLAIM) { in nlm_host_notify_client()
1263 mutex_exit(&hostp->nh_lock); in nlm_host_notify_client()
1267 hostp->nh_flags |= NLM_NH_RECLAIM; in nlm_host_notify_client()
1273 hostp->nh_refs++; in nlm_host_notify_client()
1274 mutex_exit(&hostp->nh_lock); in nlm_host_notify_client()
1277 hostp, 0, minclsyspri); in nlm_host_notify_client()
1287 nlm_host_wait_grace(struct nlm_host *hostp) in nlm_host_wait_grace() argument
1293 mutex_enter(&hostp->nh_lock); in nlm_host_wait_grace()
1298 rc = cv_timedwait_sig(&hostp->nh_recl_cv, in nlm_host_wait_grace()
1299 &hostp->nh_lock, ddi_get_lbolt() + in nlm_host_wait_grace()
1306 } while (hostp->nh_flags & NLM_NH_RECLAIM); in nlm_host_wait_grace()
1308 mutex_exit(&hostp->nh_lock); in nlm_host_wait_grace()
1356 nlm_host_cancel_slocks(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_cancel_slocks() argument
1362 if (nslp->nsl_host == hostp) { in nlm_host_cancel_slocks()
1380 nlm_host_gc_vholds(struct nlm_host *hostp) in nlm_host_gc_vholds() argument
1384 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_host_gc_vholds()
1386 nvp = TAILQ_FIRST(&hostp->nh_vholds_list); in nlm_host_gc_vholds()
1390 if (nlm_vhold_busy(hostp, nvp)) { in nlm_host_gc_vholds()
1396 nlm_vhold_destroy(hostp, nvp); in nlm_host_gc_vholds()
1406 nlm_host_has_srv_locks(struct nlm_host *hostp) in nlm_host_has_srv_locks() argument
1419 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_host_has_srv_locks()
1420 if (!TAILQ_EMPTY(&hostp->nh_vholds_list)) in nlm_host_has_srv_locks()
1431 nlm_host_has_cli_locks(struct nlm_host *hostp) in nlm_host_has_cli_locks() argument
1433 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_host_has_cli_locks()
1454 if (flk_sysid_has_locks(hostp->nh_sysid | in nlm_host_has_cli_locks()
1462 if (hostp->nh_shrlist != NULL) in nlm_host_has_cli_locks()
1473 nlm_host_has_locks(struct nlm_host *hostp) in nlm_host_has_locks() argument
1475 if (nlm_host_has_srv_locks(hostp)) in nlm_host_has_locks()
1478 return (nlm_host_has_cli_locks(hostp)); in nlm_host_has_locks()
1558 struct nlm_host *hostp, key; in nlm_host_find_locked() local
1568 hostp = avl_find(&g->nlm_hosts_tree, &key, &pos); in nlm_host_find_locked()
1570 if (hostp != NULL) { in nlm_host_find_locked()
1575 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_host_find_locked()
1576 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_find_locked()
1577 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_host_find_locked()
1580 hostp->nh_refs++; in nlm_host_find_locked()
1585 return (hostp); in nlm_host_find_locked()
1595 struct nlm_host *hostp = NULL; in nlm_host_find() local
1601 hostp = nlm_host_find_locked(g, netid, addr, NULL); in nlm_host_find()
1605 return (hostp); in nlm_host_find()
1694 struct nlm_host *hostp = NULL; in nlm_host_find_by_sysid() local
1702 (mod_hash_val_t)&hostp); in nlm_host_find_by_sysid()
1704 if (hostp == NULL) in nlm_host_find_by_sysid()
1711 if (hostp->nh_flags & NLM_NH_INIDLE) { in nlm_host_find_by_sysid()
1712 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_find_by_sysid()
1713 hostp->nh_flags &= ~NLM_NH_INIDLE; in nlm_host_find_by_sysid()
1716 hostp->nh_refs++; in nlm_host_find_by_sysid()
1720 return (hostp); in nlm_host_find_by_sysid()
1737 nlm_host_release(struct nlm_globals *g, struct nlm_host *hostp) in nlm_host_release() argument
1739 if (hostp == NULL) in nlm_host_release()
1743 ASSERT(hostp->nh_refs > 0); in nlm_host_release()
1745 hostp->nh_refs--; in nlm_host_release()
1746 if (hostp->nh_refs != 0) { in nlm_host_release()
1756 hostp->nh_idle_timeout = ddi_get_lbolt() + in nlm_host_release()
1759 ASSERT((hostp->nh_flags & NLM_NH_INIDLE) == 0); in nlm_host_release()
1760 TAILQ_INSERT_TAIL(&g->nlm_idle_hosts, hostp, nh_link); in nlm_host_release()
1761 hostp->nh_flags |= NLM_NH_INIDLE; in nlm_host_release()
1852 nlm_host_get_state(struct nlm_host *hostp) in nlm_host_get_state() argument
1855 return (hostp->nh_state); in nlm_host_get_state()
1985 struct nlm_host *hostp, struct nlm4_lock *alock) in nlm_slock_grant() argument
1993 (nslp->nsl_host != hostp)) in nlm_slock_grant()
2021 nlm_slreq_register(struct nlm_host *hostp, struct nlm_vhold *nvp, in nlm_slreq_register() argument
2027 mutex_enter(&hostp->nh_lock); in nlm_slreq_register()
2028 slr = nlm_slreq_find_locked(hostp, nvp, flp); in nlm_slreq_register()
2032 mutex_exit(&hostp->nh_lock); in nlm_slreq_register()
2036 mutex_enter(&hostp->nh_lock); in nlm_slreq_register()
2037 slr = nlm_slreq_find_locked(hostp, nvp, flp); in nlm_slreq_register()
2047 mutex_exit(&hostp->nh_lock); in nlm_slreq_register()
2062 nlm_slreq_unregister(struct nlm_host *hostp, struct nlm_vhold *nvp, in nlm_slreq_unregister() argument
2067 mutex_enter(&hostp->nh_lock); in nlm_slreq_unregister()
2068 slr = nlm_slreq_find_locked(hostp, nvp, flp); in nlm_slreq_unregister()
2070 mutex_exit(&hostp->nh_lock); in nlm_slreq_unregister()
2075 mutex_exit(&hostp->nh_lock); in nlm_slreq_unregister()
2085 nlm_slreq_find_locked(struct nlm_host *hostp, struct nlm_vhold *nvp, in nlm_slreq_find_locked() argument
2090 ASSERT(MUTEX_HELD(&hostp->nh_lock)); in nlm_slreq_find_locked()
2119 nlm_shres_track(struct nlm_host *hostp, vnode_t *vp, struct shrlock *shrp) in nlm_shres_track() argument
2130 mutex_enter(&hostp->nh_lock); in nlm_shres_track()
2131 for (nsp = hostp->nh_shrlist; nsp != NULL; nsp = nsp->ns_next) in nlm_shres_track()
2145 nsp->ns_next = hostp->nh_shrlist; in nlm_shres_track()
2146 hostp->nh_shrlist = nsp; in nlm_shres_track()
2149 mutex_exit(&hostp->nh_lock); in nlm_shres_track()
2155 nlm_shres_untrack(struct nlm_host *hostp, vnode_t *vp, struct shrlock *shrp) in nlm_shres_untrack() argument
2159 mutex_enter(&hostp->nh_lock); in nlm_shres_untrack()
2160 nsp = hostp->nh_shrlist; in nlm_shres_untrack()
2170 hostp->nh_shrlist = nsp; in nlm_shres_untrack()
2180 mutex_exit(&hostp->nh_lock); in nlm_shres_untrack()
2190 nlm_get_active_shres(struct nlm_host *hostp) in nlm_get_active_shres() argument
2194 mutex_enter(&hostp->nh_lock); in nlm_get_active_shres()
2195 for (nsp = hostp->nh_shrlist; nsp != NULL; nsp = nsp->ns_next) { in nlm_get_active_shres()
2203 mutex_exit(&hostp->nh_lock); in nlm_get_active_shres()
2395 struct nlm_host *hostp; in nlm_svc_stopping() local
2402 hostp = avl_first(&g->nlm_hosts_tree); in nlm_svc_stopping()
2403 while (hostp != NULL) { in nlm_svc_stopping()
2405 nlm_client_cancel_all(g, hostp); in nlm_svc_stopping()
2406 nlm_host_notify_server(hostp, 0); in nlm_svc_stopping()
2408 mutex_enter(&hostp->nh_lock); in nlm_svc_stopping()
2409 nlm_host_gc_vholds(hostp); in nlm_svc_stopping()
2410 if (hostp->nh_refs > 0 || nlm_host_has_locks(hostp)) { in nlm_svc_stopping()
2417 mutex_exit(&hostp->nh_lock); in nlm_svc_stopping()
2418 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_svc_stopping()
2423 mutex_exit(&hostp->nh_lock); in nlm_svc_stopping()
2424 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_svc_stopping()
2434 while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) { in nlm_svc_stopping()
2435 nlm_host_unregister(g, hostp); in nlm_svc_stopping()
2436 nlm_host_destroy(hostp); in nlm_svc_stopping()
2465 struct nlm_host *hostp; in nlm_vp_active() local
2477 hostp = avl_first(&g->nlm_hosts_tree); in nlm_vp_active()
2478 while (hostp != NULL) { in nlm_vp_active()
2479 mutex_enter(&hostp->nh_lock); in nlm_vp_active()
2480 nvp = nlm_vhold_find_locked(hostp, vp); in nlm_vp_active()
2481 mutex_exit(&hostp->nh_lock); in nlm_vp_active()
2487 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_vp_active()
2505 struct nlm_host *hostp; in nlm_unexport() local
2510 hostp = avl_first(&g->nlm_hosts_tree); in nlm_unexport()
2511 while (hostp != NULL) { in nlm_unexport()
2514 mutex_enter(&hostp->nh_lock); in nlm_unexport()
2515 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) { in nlm_unexport()
2519 mutex_exit(&hostp->nh_lock); in nlm_unexport()
2532 nlm_vhold_clean(nvp, hostp->nh_sysid); in nlm_unexport()
2535 mutex_enter(&hostp->nh_lock); in nlm_unexport()
2539 mutex_exit(&hostp->nh_lock); in nlm_unexport()
2540 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp); in nlm_unexport()