Print this page
Fix NFS design problems re. multiple zone keys
Make NFS server zone-specific data all have the same lifetime
Fix rfs4_clean_state_exi
Fix exi_cache_reclaim
Fix mistakes in zone keys work
More fixes re. exi_zoneid and exi_tree
(danmcd -> Keep some ASSERT()s around for readability.)
        
@@ -89,12 +89,20 @@
 static int      rdma_setup_read_data3(READ3args *, READ3resok *);
 
 extern int nfs_loaned_buffers;
 
 u_longlong_t nfs3_srv_caller_id;
-static zone_key_t rfs3_zone_key;
 
+static nfs3_srv_t *
+nfs3_get_srv(void)
+{
+        nfs_globals_t *ng = zone_getspecific(nfssrv_zone_key, curzone);
+        nfs3_srv_t *srv = ng->nfs3_srv;
+        ASSERT(srv != NULL);
+        return (srv);
+}
+
 /* ARGSUSED */
 void
 rfs3_getattr(GETATTR3args *args, GETATTR3res *resp, struct exportinfo *exi,
     struct svc_req *req, cred_t *cr, bool_t ro)
 {
@@ -1325,11 +1333,12 @@
                 error = ESTALE;
                 goto err;
         }
 
         ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
-        ns = zone_getspecific(rfs3_zone_key, curzone);
+        ns = nfs3_get_srv();
+
         if (is_system_labeled()) {
                 bslabel_t *clabel = req->rq_label;
 
                 ASSERT(clabel != NULL);
                 DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
@@ -4126,11 +4135,11 @@
                 error = ESTALE;
                 goto out;
         }
 
         ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
-        ns = zone_getspecific(rfs3_zone_key, curzone);
+        ns = nfs3_get_srv();
         bva.va_mask = AT_ALL;
         error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
 
         /*
          * If we can't get the attributes, then we can't do the
@@ -4379,13 +4388,12 @@
         rok->wlist_len = wlist_len;
         rok->wlist = wcl;
         return (TRUE);
 }
 
-/* ARGSUSED */
-static void *
-rfs3_zone_init(zoneid_t zoneid)
+void
+rfs3_srv_zone_init(nfs_globals_t *ng)
 {
         nfs3_srv_t *ns;
         struct rfs3_verf_overlay {
                 uint_t id; /* a "unique" identifier */
                 int ts; /* a unique timestamp */
@@ -4426,27 +4434,27 @@
         verfp->id = zone_get_hostid(NULL);
 
         if (verfp->id == 0)
                 verfp->id = (uint_t)now.tv_nsec;
 
-        return (ns);
+        ng->nfs3_srv = ns;
 }
 
-/* ARGSUSED */
-static void
-rfs3_zone_fini(zoneid_t zoneid, void *data)
+void
+rfs3_srv_zone_fini(nfs_globals_t *ng)
 {
-        nfs3_srv_t *ns = data;
+        nfs3_srv_t *ns = ng->nfs3_srv;
 
+        ng->nfs3_srv = NULL;
+
         kmem_free(ns, sizeof (*ns));
 }
 
 void
 rfs3_srvrinit(void)
 {
         nfs3_srv_caller_id = fs_new_caller_id();
-        zone_key_create(&rfs3_zone_key, rfs3_zone_init, NULL, rfs3_zone_fini);
 }
 
 void
 rfs3_srvrfini(void)
 {