summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/klm/nlm_impl.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/klm/nlm_impl.c')
-rw-r--r--usr/src/uts/common/klm/nlm_impl.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/usr/src/uts/common/klm/nlm_impl.c b/usr/src/uts/common/klm/nlm_impl.c
index e787f70ebd..cbba11f6ed 100644
--- a/usr/src/uts/common/klm/nlm_impl.c
+++ b/usr/src/uts/common/klm/nlm_impl.c
@@ -849,7 +849,7 @@ nlm_nsm_init(struct nlm_nsm *nsm, struct knetconfig *knc, struct netbuf *nb)
* statd using the status monitor protocol.
*/
error = clnt_tli_kcreate(&nsm->ns_knc, &nsm->ns_addr, SM_PROG, SM_VERS,
- 0, NLM_RPC_RETRIES, kcred, &nsm->ns_handle);
+ 0, NLM_RPC_RETRIES, zone_kcred(), &nsm->ns_handle);
if (error != 0)
goto error;
@@ -858,7 +858,8 @@ nlm_nsm_init(struct nlm_nsm *nsm, struct knetconfig *knc, struct netbuf *nb)
* local statd using the address registration protocol.
*/
error = clnt_tli_kcreate(&nsm->ns_knc, &nsm->ns_addr, NSM_ADDR_PROGRAM,
- NSM_ADDR_V1, 0, NLM_RPC_RETRIES, kcred, &nsm->ns_addr_handle);
+ NSM_ADDR_V1, 0, NLM_RPC_RETRIES, zone_kcred(),
+ &nsm->ns_addr_handle);
if (error != 0)
goto error;
@@ -867,8 +868,11 @@ nlm_nsm_init(struct nlm_nsm *nsm, struct knetconfig *knc, struct netbuf *nb)
error:
kmem_free(nsm->ns_addr.buf, nsm->ns_addr.maxlen);
- if (nsm->ns_handle)
+ if (nsm->ns_handle) {
+ ASSERT(nsm->ns_handle->cl_auth != NULL);
+ auth_destroy(nsm->ns_handle->cl_auth);
CLNT_DESTROY(nsm->ns_handle);
+ }
return (error);
}
@@ -877,8 +881,12 @@ static void
nlm_nsm_fini(struct nlm_nsm *nsm)
{
kmem_free(nsm->ns_addr.buf, nsm->ns_addr.maxlen);
+ if (nsm->ns_addr_handle->cl_auth != NULL)
+ auth_destroy(nsm->ns_addr_handle->cl_auth);
CLNT_DESTROY(nsm->ns_addr_handle);
nsm->ns_addr_handle = NULL;
+ if (nsm->ns_handle->cl_auth != NULL)
+ auth_destroy(nsm->ns_handle->cl_auth);
CLNT_DESTROY(nsm->ns_handle);
nsm->ns_handle = NULL;
sema_destroy(&nsm->ns_sem);
@@ -2589,14 +2597,17 @@ nlm_vp_active(const vnode_t *vp)
* on them.
*/
void
-nlm_unexport(struct exportinfo *exi)
+nlm_zone_unexport(struct nlm_globals *g, struct exportinfo *exi)
{
- struct nlm_globals *g;
struct nlm_host *hostp;
- g = zone_getspecific(nlm_zone_key, curzone);
-
mutex_enter(&g->lock);
+ if (g->run_status != NLM_ST_UP) {
+ /* nothing to do */
+ mutex_exit(&g->lock);
+ return;
+ }
+
hostp = avl_first(&g->nlm_hosts_tree);
while (hostp != NULL) {
struct nlm_vhold *nvp;
@@ -2644,6 +2655,28 @@ nlm_unexport(struct exportinfo *exi)
mutex_exit(&g->lock);
}
+void
+nlm_unexport(struct exportinfo *exi)
+{
+ struct nlm_globals *g;
+
+ rw_enter(&lm_lck, RW_READER);
+ TAILQ_FOREACH(g, &nlm_zones_list, nlm_link) {
+ if (g->nlm_zoneid == exi->exi_zoneid) {
+ /*
+ * NOTE: If we want to drop lm_lock before
+ * calling nlm_zone_unexport(), we should break,
+ * and have a post-rw_exit() snippit like:
+ * if (g != NULL)
+ * nlm_zone_unexport(g, exi);
+ */
+ nlm_zone_unexport(g, exi);
+ break; /* Only going to match once! */
+ }
+ }
+ rw_exit(&lm_lck);
+}
+
/*
* Allocate new unique sysid.
* In case of failure (no available sysids)
@@ -2812,7 +2845,7 @@ void
nlm_nsm_clnt_init(CLIENT *clnt, struct nlm_nsm *nsm)
{
(void) clnt_tli_kinit(clnt, &nsm->ns_knc, &nsm->ns_addr, 0,
- NLM_RPC_RETRIES, kcred);
+ NLM_RPC_RETRIES, zone_kcred());
}
void