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,100 ****
  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;
  
  /* ARGSUSED */
  void
  rfs3_getattr(GETATTR3args *args, GETATTR3res *resp, struct exportinfo *exi,
      struct svc_req *req, cred_t *cr, bool_t ro)
  {
--- 89,108 ----
  static int      rdma_setup_read_data3(READ3args *, READ3resok *);
  
  extern int nfs_loaned_buffers;
  
  u_longlong_t nfs3_srv_caller_id;
  
+ 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,1335 ****
                  error = ESTALE;
                  goto err;
          }
  
          ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
!         ns = zone_getspecific(rfs3_zone_key, curzone);
          if (is_system_labeled()) {
                  bslabel_t *clabel = req->rq_label;
  
                  ASSERT(clabel != NULL);
                  DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
--- 1333,1344 ----
                  error = ESTALE;
                  goto err;
          }
  
          ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
!         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,4136 ****
                  error = ESTALE;
                  goto out;
          }
  
          ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
!         ns = zone_getspecific(rfs3_zone_key, curzone);
          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
--- 4135,4145 ----
                  error = ESTALE;
                  goto out;
          }
  
          ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
!         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,4391 ****
          rok->wlist_len = wlist_len;
          rok->wlist = wcl;
          return (TRUE);
  }
  
! /* ARGSUSED */
! static void *
! rfs3_zone_init(zoneid_t zoneid)
  {
          nfs3_srv_t *ns;
          struct rfs3_verf_overlay {
                  uint_t id; /* a "unique" identifier */
                  int ts; /* a unique timestamp */
--- 4388,4399 ----
          rok->wlist_len = wlist_len;
          rok->wlist = wcl;
          return (TRUE);
  }
  
! 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,4452 ****
          verfp->id = zone_get_hostid(NULL);
  
          if (verfp->id == 0)
                  verfp->id = (uint_t)now.tv_nsec;
  
!         return (ns);
  }
  
! /* ARGSUSED */
! static void
! rfs3_zone_fini(zoneid_t zoneid, void *data)
  {
!         nfs3_srv_t *ns = data;
  
          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)
  {
--- 4434,4460 ----
          verfp->id = zone_get_hostid(NULL);
  
          if (verfp->id == 0)
                  verfp->id = (uint_t)now.tv_nsec;
  
!         ng->nfs3_srv = ns;
  }
  
! void
! rfs3_srv_zone_fini(nfs_globals_t *ng)
  {
!         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();
  }
  
  void
  rfs3_srvrfini(void)
  {