Print this page
curzone reality check and teardown changes to use the RIGHT zone


2550                 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp);
2551         }
2552 
2553         mutex_exit(&g->lock);
2554         return (active);
2555 }
2556 
2557 /*
2558  * Called right before NFS export is going to
2559  * dissapear. The function finds all vnodes
2560  * belonging to the given export and cleans
2561  * all remote locks and share reservations
2562  * on them.
2563  */
2564 void
2565 nlm_unexport(struct exportinfo *exi)
2566 {
2567         struct nlm_globals *g;
2568         struct nlm_host *hostp;
2569 
2570         g = zone_getspecific(nlm_zone_key, curzone);






2571 
2572         mutex_enter(&g->lock);
2573         hostp = avl_first(&g->nlm_hosts_tree);
2574         while (hostp != NULL) {
2575                 struct nlm_vhold *nvp;
2576 
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;
2580                 }
2581                 hostp->nh_refs++;
2582 
2583                 mutex_exit(&g->lock);
2584 
2585                 mutex_enter(&hostp->nh_lock);
2586                 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) {
2587                         vnode_t *vp;
2588 
2589                         nvp->nv_refcnt++;
2590                         mutex_exit(&hostp->nh_lock);




2550                 hostp = AVL_NEXT(&g->nlm_hosts_tree, hostp);
2551         }
2552 
2553         mutex_exit(&g->lock);
2554         return (active);
2555 }
2556 
2557 /*
2558  * Called right before NFS export is going to
2559  * dissapear. The function finds all vnodes
2560  * belonging to the given export and cleans
2561  * all remote locks and share reservations
2562  * on them.
2563  */
2564 void
2565 nlm_unexport(struct exportinfo *exi)
2566 {
2567         struct nlm_globals *g;
2568         struct nlm_host *hostp;
2569 
2570         /* This may be called on behalf of global-zone doing shutdown. */
2571         ASSERT(exi->exi_zone == curzone || curzone == global_zone);
2572         g = zone_getspecific(nlm_zone_key, exi->exi_zone);
2573         if (g == NULL) {
2574                 /* Did zone cleanup get here already? */
2575                 return;
2576         }
2577 
2578         mutex_enter(&g->lock);
2579         hostp = avl_first(&g->nlm_hosts_tree);
2580         while (hostp != NULL) {
2581                 struct nlm_vhold *nvp;
2582 
2583                 if (hostp->nh_flags & NLM_NH_INIDLE) {
2584                         TAILQ_REMOVE(&g->nlm_idle_hosts, hostp, nh_link);
2585                         hostp->nh_flags &= ~NLM_NH_INIDLE;
2586                 }
2587                 hostp->nh_refs++;
2588 
2589                 mutex_exit(&g->lock);
2590 
2591                 mutex_enter(&hostp->nh_lock);
2592                 TAILQ_FOREACH(nvp, &hostp->nh_vholds_list, nv_link) {
2593                         vnode_t *vp;
2594 
2595                         nvp->nv_refcnt++;
2596                         mutex_exit(&hostp->nh_lock);