Print this page
Revert exi_zone to exi_zoneid, and install exi_ne backpointer
Caution with use after exi_rele()
Dan mods to NFS desgin problems re. multiple zone keys
curzone reality check and teardown changes to use the RIGHT zone
Try to remove assumption that zone's root vnode is marked VROOT

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs_srv.c
          +++ new/usr/src/uts/common/fs/nfs/nfs_srv.c
↓ open down ↓ 409 lines elided ↑ open up ↑
 410  410   * Given mounted "dvp" and "exi", go upper mountpoint
 411  411   * with dvp/exi correction
 412  412   * Return 0 in success
 413  413   */
 414  414  int
 415  415  rfs_climb_crossmnt(vnode_t **dvpp, struct exportinfo **exip, cred_t *cr)
 416  416  {
 417  417          struct exportinfo *exi;
 418  418          vnode_t *dvp = *dvpp;
 419  419  
 420      -        ASSERT(dvp->v_flag & VROOT);
      420 +        ASSERT3U((*exip)->exi_zoneid, ==, curzone->zone_id);
      421 +        ASSERT((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp));
 421  422  
 422  423          VN_HOLD(dvp);
 423  424          dvp = untraverse(dvp);
 424  425          exi = nfs_vptoexi(NULL, dvp, cr, NULL, NULL, FALSE);
 425  426          if (exi == NULL) {
 426  427                  VN_RELE(dvp);
 427  428                  return (-1);
 428  429          }
 429  430  
      431 +        ASSERT3U(exi->exi_zoneid, ==, curzone->zone_id);
 430  432          exi_rele(*exip);
 431  433          *exip = exi;
 432  434          VN_RELE(*dvpp);
 433  435          *dvpp = dvp;
 434  436  
 435  437          return (0);
 436  438  }
 437  439  /*
 438  440   * Directory lookup.
 439  441   * Returns an fhandle and file attributes for file name in a directory.
↓ open down ↓ 40 lines elided ↑ open up ↑
 480  482                  VN_HOLD(dvp);
 481  483          } else {
 482  484                  dvp = nfs_fhtovp(fhp, exi);
 483  485                  if (dvp == NULL) {
 484  486                          dr->dr_status = NFSERR_STALE;
 485  487                          return;
 486  488                  }
 487  489          }
 488  490  
 489  491          exi_hold(exi);
      492 +        ASSERT3U(exi->exi_zoneid, ==, curzone->zone_id);
 490  493  
 491  494          /*
 492  495           * Not allow lookup beyond root.
 493  496           * If the filehandle matches a filehandle of the exi,
 494  497           * then the ".." refers beyond the root of an exported filesystem.
 495  498           */
 496  499          if (strcmp(da->da_name, "..") == 0 &&
 497  500              EQFID(&exi->exi_fid, (fid_t *)&fhp->fh_len)) {
 498  501                  if ((exi->exi_export.ex_flags & EX_NOHIDE) &&
 499      -                    (dvp->v_flag & VROOT)) {
      502 +                    ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp))) {
 500  503                          /*
 501  504                           * special case for ".." and 'nohide'exported root
 502  505                           */
 503  506                          if (rfs_climb_crossmnt(&dvp, &exi, cr) != 0) {
 504  507                                  error = NFSERR_ACCES;
 505  508                                  goto out;
 506  509                          }
 507  510                  } else  {
 508  511                          error = NFSERR_NOENT;
 509  512                          goto out;
↓ open down ↓ 15 lines elided ↑ open up ↑
 525  528           * a pathname and follow symbolic links if
 526  529           * necessary.
 527  530           *
 528  531           * This may result in a vnode in another filesystem
 529  532           * which is OK as long as the filesystem is exported.
 530  533           */
 531  534          if (PUBLIC_FH2(fhp)) {
 532  535                  publicfh_flag = TRUE;
 533  536  
 534  537                  exi_rele(exi);
      538 +                exi = NULL;
 535  539  
 536  540                  error = rfs_publicfh_mclookup(name, dvp, cr, &vp, &exi,
 537  541                      &sec);
 538  542          } else {
 539  543                  /*
 540  544                   * Do a normal single component lookup.
 541  545                   */
 542  546                  error = VOP_LOOKUP(dvp, name, &vp, NULL, 0, NULL, cr,
 543  547                      NULL, NULL, NULL);
 544  548          }
↓ open down ↓ 766 lines elided ↑ open up ↑
1311 1315          uint_t off;
1312 1316          uint_t len;
1313 1317          struct rfs_async_write nrpsp;
1314 1318          struct rfs_async_write_list nlpsp;
1315 1319          ushort_t t_flag;
1316 1320          cred_t *savecred;
1317 1321          int in_crit = 0;
1318 1322          caller_context_t ct;
1319 1323          nfs_srv_t *nsrv;
1320 1324  
     1325 +        ASSERT(exi == NULL || exi->exi_zoneid == curzone->zone_id);
1321 1326          nsrv = nfs_get_srv();
1322 1327          if (!nsrv->write_async) {
1323 1328                  rfs_write_sync(wa, ns, exi, req, cr, ro);
1324 1329                  return;
1325 1330          }
1326 1331  
1327 1332          /*
1328 1333           * Initialize status to RFSWRITE_INITVAL instead of 0, since value of 0
1329 1334           * is considered an OK.
1330 1335           */
↓ open down ↓ 1829 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX