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.)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs3_srv.c
          +++ new/usr/src/uts/common/fs/nfs/nfs3_srv.c
↓ open down ↓ 83 lines elided ↑ open up ↑
  84   84  static int      sattr3_to_vattr(sattr3 *, struct vattr *);
  85   85  static int      vattr_to_fattr3(struct vattr *, fattr3 *);
  86   86  static int      vattr_to_wcc_attr(struct vattr *, wcc_attr *);
  87   87  static void     vattr_to_pre_op_attr(struct vattr *, pre_op_attr *);
  88   88  static void     vattr_to_wcc_data(struct vattr *, struct vattr *, wcc_data *);
  89   89  static int      rdma_setup_read_data3(READ3args *, READ3resok *);
  90   90  
  91   91  extern int nfs_loaned_buffers;
  92   92  
  93   93  u_longlong_t nfs3_srv_caller_id;
  94      -static zone_key_t rfs3_zone_key;
  95   94  
       95 +static nfs3_srv_t *
       96 +nfs3_get_srv(void)
       97 +{
       98 +        nfs_globals_t *ng = zone_getspecific(nfssrv_zone_key, curzone);
       99 +        nfs3_srv_t *srv = ng->nfs3_srv;
      100 +        ASSERT(srv != NULL);
      101 +        return (srv);
      102 +}
      103 +
  96  104  /* ARGSUSED */
  97  105  void
  98  106  rfs3_getattr(GETATTR3args *args, GETATTR3res *resp, struct exportinfo *exi,
  99  107      struct svc_req *req, cred_t *cr, bool_t ro)
 100  108  {
 101  109          int error;
 102  110          vnode_t *vp;
 103  111          struct vattr va;
 104  112  
 105  113          vp = nfs3_fhtovp(&args->object, exi);
↓ open down ↓ 1214 lines elided ↑ open up ↑
1320 1328          DTRACE_NFSV3_5(op__write__start, struct svc_req *, req,
1321 1329              cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
1322 1330              WRITE3args *, args);
1323 1331  
1324 1332          if (vp == NULL) {
1325 1333                  error = ESTALE;
1326 1334                  goto err;
1327 1335          }
1328 1336  
1329 1337          ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
1330      -        ns = zone_getspecific(rfs3_zone_key, curzone);
     1338 +        ns = nfs3_get_srv();
     1339 +
1331 1340          if (is_system_labeled()) {
1332 1341                  bslabel_t *clabel = req->rq_label;
1333 1342  
1334 1343                  ASSERT(clabel != NULL);
1335 1344                  DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
1336 1345                      "got client label from request(1)", struct svc_req *, req);
1337 1346  
1338 1347                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
1339 1348                          if (!do_rfs_label_check(clabel, vp, EQUALITY_CHECK,
1340 1349                              exi)) {
↓ open down ↓ 2780 lines elided ↑ open up ↑
4121 4130          DTRACE_NFSV3_5(op__commit__start, struct svc_req *, req,
4122 4131              cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
4123 4132              COMMIT3args *, args);
4124 4133  
4125 4134          if (vp == NULL) {
4126 4135                  error = ESTALE;
4127 4136                  goto out;
4128 4137          }
4129 4138  
4130 4139          ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
4131      -        ns = zone_getspecific(rfs3_zone_key, curzone);
     4140 +        ns = nfs3_get_srv();
4132 4141          bva.va_mask = AT_ALL;
4133 4142          error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4134 4143  
4135 4144          /*
4136 4145           * If we can't get the attributes, then we can't do the
4137 4146           * right access checking.  So, we'll fail the request.
4138 4147           */
4139 4148          if (error)
4140 4149                  goto out;
4141 4150  
↓ open down ↓ 232 lines elided ↑ open up ↑
4374 4383          wcl = args->wlist;
4375 4384          if (rdma_setup_read_chunks(wcl, count, &wlist_len) == FALSE)
4376 4385                  return (FALSE);
4377 4386  
4378 4387          wcl = args->wlist;
4379 4388          rok->wlist_len = wlist_len;
4380 4389          rok->wlist = wcl;
4381 4390          return (TRUE);
4382 4391  }
4383 4392  
4384      -/* ARGSUSED */
4385      -static void *
4386      -rfs3_zone_init(zoneid_t zoneid)
     4393 +void
     4394 +rfs3_srv_zone_init(nfs_globals_t *ng)
4387 4395  {
4388 4396          nfs3_srv_t *ns;
4389 4397          struct rfs3_verf_overlay {
4390 4398                  uint_t id; /* a "unique" identifier */
4391 4399                  int ts; /* a unique timestamp */
4392 4400          } *verfp;
4393 4401          timestruc_t now;
4394 4402  
4395 4403          ns = kmem_zalloc(sizeof (*ns), KM_SLEEP);
4396 4404  
↓ open down ↓ 24 lines elided ↑ open up ↑
4421 4429  #endif
4422 4430  
4423 4431          gethrestime(&now);
4424 4432          verfp = (struct rfs3_verf_overlay *)&ns->write3verf;
4425 4433          verfp->ts = (int)now.tv_sec;
4426 4434          verfp->id = zone_get_hostid(NULL);
4427 4435  
4428 4436          if (verfp->id == 0)
4429 4437                  verfp->id = (uint_t)now.tv_nsec;
4430 4438  
4431      -        return (ns);
     4439 +        ng->nfs3_srv = ns;
4432 4440  }
4433 4441  
4434      -/* ARGSUSED */
4435      -static void
4436      -rfs3_zone_fini(zoneid_t zoneid, void *data)
     4442 +void
     4443 +rfs3_srv_zone_fini(nfs_globals_t *ng)
4437 4444  {
4438      -        nfs3_srv_t *ns = data;
     4445 +        nfs3_srv_t *ns = ng->nfs3_srv;
4439 4446  
     4447 +        ng->nfs3_srv = NULL;
     4448 +
4440 4449          kmem_free(ns, sizeof (*ns));
4441 4450  }
4442 4451  
4443 4452  void
4444 4453  rfs3_srvrinit(void)
4445 4454  {
4446 4455          nfs3_srv_caller_id = fs_new_caller_id();
4447      -        zone_key_create(&rfs3_zone_key, rfs3_zone_init, NULL, rfs3_zone_fini);
4448 4456  }
4449 4457  
4450 4458  void
4451 4459  rfs3_srvrfini(void)
4452 4460  {
4453 4461          /* Nothing to do */
4454 4462  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX