Lines Matching refs:hostp

347 	struct nlm_host *hostp;
373 for (hostp = avl_first(&g->nlm_hosts_tree); hostp != NULL;
374 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp)) {
377 mutex_enter(&hostp->nh_lock);
379 nvp = TAILQ_FIRST(&hostp->nh_vholds_list);
398 nlm_vhold_destroy(hostp, nvp);
404 mutex_exit(&hostp->nh_lock);
411 while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) {
414 if (hostp->nh_idle_timeout > now)
424 mutex_enter(&hostp->nh_lock);
431 nlm_host_gc_vholds(hostp);
432 has_locks = nlm_host_has_locks(hostp);
434 mutex_exit(&hostp->nh_lock);
446 if ((hostp->nh_flags & NLM_NH_INIDLE) == 0 ||
447 hostp->nh_idle_timeout > now)
457 hostp, nh_link);
458 hostp->nh_idle_timeout = now + idle_period;
460 hostp, nh_link);
473 nlm_host_unregister(g, hostp);
476 nlm_host_unmonitor(g, hostp);
477 nlm_host_destroy(hostp);
499 * on the given server represented by hostp.
502 nlm_reclaimer(struct nlm_host *hostp)
506 mutex_enter(&hostp->nh_lock);
507 hostp->nh_reclaimer = curthread;
508 mutex_exit(&hostp->nh_lock);
511 nlm_reclaim_client(g, hostp);
513 mutex_enter(&hostp->nh_lock);
514 hostp->nh_flags &= ~NLM_NH_RECLAIM;
515 hostp->nh_reclaimer = NULL;
516 cv_broadcast(&hostp->nh_recl_cv);
517 mutex_exit(&hostp->nh_lock);
524 nlm_host_release(g, hostp);
603 struct nlm_host *hostp;
619 for (hostp = avl_first(&g->nlm_hosts_tree); hostp != NULL;
620 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp)) {
626 if (hostp->nh_flags & NLM_NH_INIDLE) {
627 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link);
628 hostp->nh_flags &= ~NLM_NH_INIDLE;
631 hostp->nh_refs++;
632 TAILQ_INSERT_TAIL(&all_hosts, hostp, nh_link);
642 while ((hostp = TAILQ_FIRST(&all_hosts)) != NULL) {
643 mutex_enter(&hostp->nh_lock);
644 if (nlm_host_has_locks(hostp))
645 hostp->nh_flags |= NLM_NH_SUSPEND;
647 mutex_exit(&hostp->nh_lock);
648 TAILQ_REMOVE(&all_hosts, hostp, nh_link);
665 struct nlm_host *hostp, *h_next;
668 hostp = avl_first(&g->nlm_hosts_tree);
676 while (hostp != NULL) {
683 h_next = AVL_NEXT(&g->nlm_hosts_tree, hostp);
686 DTRACE_PROBE1(resume__host, struct nlm_host *, hostp);
692 if (!(hostp->nh_flags & NLM_NH_SUSPEND))
695 error = nlm_nsm_init(&nsm, &hostp->nh_knc, &hostp->nh_addr);
698 "[error=%d]\n", hostp->nh_name, error);
706 "host %s [stat=%d]\n", hostp->nh_name, stat);
712 if (sm_state != hostp->nh_state) {
721 nlm_host_notify_client(hostp, sm_state);
722 nlm_host_notify_server(hostp, sm_state);
733 nlm_host_notify_server(hostp, 0);
734 nlm_client_cancel_all(g, hostp);
737 hostp->nh_flags &= ~NLM_NH_SUSPEND;
738 nlm_host_release(g, hostp);
739 hostp = h_next;
995 nlm_vhold_get(struct nlm_host *hostp, vnode_t *vp)
999 mutex_enter(&hostp->nh_lock);
1000 nvp = nlm_vhold_find_locked(hostp, vp);
1005 mutex_exit(&hostp->nh_lock);
1012 mutex_enter(&hostp->nh_lock);
1013 nvp = nlm_vhold_find_locked(hostp, vp);
1023 VERIFY(mod_hash_insert(hostp->nh_vholds_by_vp,
1025 TAILQ_INSERT_TAIL(&hostp->nh_vholds_list, nvp, nv_link);
1029 mutex_exit(&hostp->nh_lock);
1040 nlm_vhold_release(struct nlm_host *hostp, struct nlm_vhold *nvp)
1045 mutex_enter(&hostp->nh_lock);
1059 nlm_vhold_destroy(hostp, nvp);
1062 mutex_exit(&hostp->nh_lock);
1078 nlm_vhold_destroy(struct nlm_host *hostp, struct nlm_vhold *nvp)
1080 ASSERT(MUTEX_HELD(&hostp->nh_lock));
1085 VERIFY(mod_hash_remove(hostp->nh_vholds_by_vp,
1089 TAILQ_REMOVE(&hostp->nh_vholds_list, nvp, nv_link);
1105 nlm_vhold_busy(struct nlm_host *hostp, struct nlm_vhold *nvp)
1110 ASSERT(MUTEX_HELD(&hostp->nh_lock));
1116 sysid = hostp->nh_sysid;
1146 nlm_vhold_find_locked(struct nlm_host *hostp, const vnode_t *vp)
1150 ASSERT(MUTEX_HELD(&hostp->nh_lock));
1151 (void) mod_hash_find(hostp->nh_vholds_by_vp,
1179 struct nlm_host *hostp = (struct nlm_host *)datap;
1181 bzero(hostp, sizeof (*hostp));
1189 struct nlm_host *hostp = (struct nlm_host *)datap;
1190 ASSERT(hostp->nh_refs == 0);
1194 nlm_host_unregister(struct nlm_globals *g, struct nlm_host *hostp)
1196 ASSERT(hostp->nh_refs == 0);
1197 ASSERT(hostp->nh_flags & NLM_NH_INIDLE);
1199 avl_remove(&g->nlm_hosts_tree, hostp);
1201 (mod_hash_key_t)(uintptr_t)hostp->nh_sysid,
1202 (mod_hash_val_t)&hostp) == 0);
1203 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link);
1204 hostp->nh_flags &= ~NLM_NH_INIDLE;
1212 nlm_host_destroy(struct nlm_host *hostp)
1214 ASSERT(hostp->nh_name != NULL);
1215 ASSERT(hostp->nh_netid != NULL);
1216 ASSERT(TAILQ_EMPTY(&hostp->nh_vholds_list));
1218 strfree(hostp->nh_name);
1219 strfree(hostp->nh_netid);
1220 kmem_free(hostp->nh_addr.buf, hostp->nh_addr.maxlen);
1222 if (hostp->nh_sysid != LM_NOSYSID)
1223 nlm_sysid_free(hostp->nh_sysid);
1225 nlm_rpc_cache_destroy(hostp);
1227 ASSERT(TAILQ_EMPTY(&hostp->nh_vholds_list));
1228 mod_hash_destroy_ptrhash(hostp->nh_vholds_by_vp);
1230 mutex_destroy(&hostp->nh_lock);
1231 cv_destroy(&hostp->nh_rpcb_cv);
1232 cv_destroy(&hostp->nh_recl_cv);
1234 kmem_cache_free(nlm_hosts_cache, hostp);
1253 nlm_host_notify_server(struct nlm_host *hostp, int32_t state)
1260 mutex_enter(&hostp->nh_lock);
1262 hostp->nh_state = state;
1264 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) {
1280 mutex_exit(&hostp->nh_lock);
1282 nlm_vhold_clean(nvp, hostp->nh_sysid);
1284 mutex_enter(&hostp->nh_lock);
1288 mutex_exit(&hostp->nh_lock);
1309 nlm_host_notify_client(struct nlm_host *hostp, int32_t state)
1311 mutex_enter(&hostp->nh_lock);
1312 hostp->nh_state = state;
1313 if (hostp->nh_flags & NLM_NH_RECLAIM) {
1318 mutex_exit(&hostp->nh_lock);
1322 hostp->nh_flags |= NLM_NH_RECLAIM;
1328 hostp->nh_refs++;
1329 mutex_exit(&hostp->nh_lock);
1332 hostp, 0, minclsyspri);
1342 nlm_host_wait_grace(struct nlm_host *hostp)
1348 mutex_enter(&hostp->nh_lock);
1353 rc = cv_timedwait_sig(&hostp->nh_recl_cv,
1354 &hostp->nh_lock, ddi_get_lbolt() +
1361 } while (hostp->nh_flags & NLM_NH_RECLAIM);
1363 mutex_exit(&hostp->nh_lock);
1411 nlm_host_cancel_slocks(struct nlm_globals *g, struct nlm_host *hostp)
1417 if (nslp->nsl_host == hostp) {
1435 nlm_host_gc_vholds(struct nlm_host *hostp)
1439 ASSERT(MUTEX_HELD(&hostp->nh_lock));
1441 nvp = TAILQ_FIRST(&hostp->nh_vholds_list);
1445 if (nlm_vhold_busy(hostp, nvp)) {
1451 nlm_vhold_destroy(hostp, nvp);
1461 nlm_host_has_srv_locks(struct nlm_host *hostp)
1474 ASSERT(MUTEX_HELD(&hostp->nh_lock));
1475 if (!TAILQ_EMPTY(&hostp->nh_vholds_list))
1486 nlm_host_has_cli_locks(struct nlm_host *hostp)
1488 ASSERT(MUTEX_HELD(&hostp->nh_lock));
1509 if (flk_sysid_has_locks(hostp->nh_sysid |
1517 if (hostp->nh_shrlist != NULL)
1528 nlm_host_has_locks(struct nlm_host *hostp)
1530 if (nlm_host_has_srv_locks(hostp))
1533 return (nlm_host_has_cli_locks(hostp));
1613 struct nlm_host *hostp, key;
1623 hostp = avl_find(&g->nlm_hosts_tree, &key, &pos);
1625 if (hostp != NULL) {
1630 if (hostp->nh_flags & NLM_NH_INIDLE) {
1631 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link);
1632 hostp->nh_flags &= ~NLM_NH_INIDLE;
1635 hostp->nh_refs++;
1640 return (hostp);
1650 struct nlm_host *hostp = NULL;
1656 hostp = nlm_host_find_locked(g, netid, addr, NULL);
1660 return (hostp);
1749 struct nlm_host *hostp = NULL;
1757 (mod_hash_val_t)&hostp);
1759 if (hostp == NULL)
1766 if (hostp->nh_flags & NLM_NH_INIDLE) {
1767 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link);
1768 hostp->nh_flags &= ~NLM_NH_INIDLE;
1771 hostp->nh_refs++;
1775 return (hostp);
1792 nlm_host_release_locked(struct nlm_globals *g, struct nlm_host *hostp)
1794 if (hostp == NULL)
1798 ASSERT(hostp->nh_refs > 0);
1800 hostp->nh_refs--;
1801 if (hostp->nh_refs != 0)
1809 hostp->nh_idle_timeout = ddi_get_lbolt() +
1812 ASSERT((hostp->nh_flags & NLM_NH_INIDLE) == 0);
1813 TAILQ_INSERT_TAIL(&g->nlm_idle_hosts, hostp, nh_link);
1814 hostp->nh_flags |= NLM_NH_INIDLE;
1818 nlm_host_release(struct nlm_globals *g, struct nlm_host *hostp)
1820 if (hostp == NULL)
1824 nlm_host_release_locked(g, hostp);
1915 nlm_host_get_state(struct nlm_host *hostp)
1918 return (hostp->nh_state);
2048 struct nlm_host *hostp, struct nlm4_lock *alock)
2056 (nslp->nsl_host != hostp))
2084 nlm_slreq_register(struct nlm_host *hostp, struct nlm_vhold *nvp,
2090 mutex_enter(&hostp->nh_lock);
2091 slr = nlm_slreq_find_locked(hostp, nvp, flp);
2095 mutex_exit(&hostp->nh_lock);
2099 mutex_enter(&hostp->nh_lock);
2100 slr = nlm_slreq_find_locked(hostp, nvp, flp);
2110 mutex_exit(&hostp->nh_lock);
2125 nlm_slreq_unregister(struct nlm_host *hostp, struct nlm_vhold *nvp,
2130 mutex_enter(&hostp->nh_lock);
2131 slr = nlm_slreq_find_locked(hostp, nvp, flp);
2133 mutex_exit(&hostp->nh_lock);
2138 mutex_exit(&hostp->nh_lock);
2148 nlm_slreq_find_locked(struct nlm_host *hostp, struct nlm_vhold *nvp,
2153 ASSERT(MUTEX_HELD(&hostp->nh_lock));
2182 nlm_shres_track(struct nlm_host *hostp, vnode_t *vp, struct shrlock *shrp)
2193 mutex_enter(&hostp->nh_lock);
2194 for (nsp = hostp->nh_shrlist; nsp != NULL; nsp = nsp->ns_next)
2208 nsp->ns_next = hostp->nh_shrlist;
2209 hostp->nh_shrlist = nsp;
2212 mutex_exit(&hostp->nh_lock);
2218 nlm_shres_untrack(struct nlm_host *hostp, vnode_t *vp, struct shrlock *shrp)
2222 mutex_enter(&hostp->nh_lock);
2223 nsp = hostp->nh_shrlist;
2233 hostp->nh_shrlist = nsp;
2243 mutex_exit(&hostp->nh_lock);
2253 nlm_get_active_shres(struct nlm_host *hostp)
2257 mutex_enter(&hostp->nh_lock);
2258 for (nsp = hostp->nh_shrlist; nsp != NULL; nsp = nsp->ns_next) {
2266 mutex_exit(&hostp->nh_lock);
2458 struct nlm_host *hostp;
2465 hostp = avl_first(&g->nlm_hosts_tree);
2466 while (hostp != NULL) {
2468 nlm_client_cancel_all(g, hostp);
2469 nlm_host_notify_server(hostp, 0);
2471 mutex_enter(&hostp->nh_lock);
2472 nlm_host_gc_vholds(hostp);
2473 if (hostp->nh_refs > 0 || nlm_host_has_locks(hostp)) {
2480 mutex_exit(&hostp->nh_lock);
2481 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp);
2486 mutex_exit(&hostp->nh_lock);
2487 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp);
2497 while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) {
2498 nlm_host_unregister(g, hostp);
2499 nlm_host_destroy(hostp);
2528 struct nlm_host *hostp;
2540 hostp = avl_first(&g->nlm_hosts_tree);
2541 while (hostp != NULL) {
2542 mutex_enter(&hostp->nh_lock);
2543 nvp = nlm_vhold_find_locked(hostp, vp);
2544 mutex_exit(&hostp->nh_lock);
2550 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp);
2568 struct nlm_host *hostp;
2573 hostp = avl_first(&g->nlm_hosts_tree);
2574 while (hostp != NULL) {
2577 if (hostp->nh_flags & NLM_NH_INIDLE) {
2578 TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link);
2579 hostp->nh_flags &= ~NLM_NH_INIDLE;
2581 hostp->nh_refs++;
2585 mutex_enter(&hostp->nh_lock);
2586 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) {
2590 mutex_exit(&hostp->nh_lock);
2603 nlm_vhold_clean(nvp, hostp->nh_sysid);
2606 mutex_enter(&hostp->nh_lock);
2609 mutex_exit(&hostp->nh_lock);
2612 nlm_host_release_locked(g, hostp);
2614 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp);